custom class

This topic is: not resolved

Tagged: 

This topic contains 4 replies, has 2 voices, and was last updated by  braddalton 1 year, 6 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #23334

    lisaleague
    Participant
    Post count: 32

    Hi!

    What is the best way to create a custom class that I can use on a  per page or per post basis that I can use to center the page or post title?

    Right now, I’m doing this with inline styles on about 5 pages/posts or less, but the HTML shows shows if shared using a social widget or browser plugin.

    Example on home page http://www.qpractice.com/

    #23338

    braddalton
    Participant
    Post count: 9743

    Grab the page or post i.d using Firebug or view the source code.

    Otherwise add a custom body class using the Layout Settings.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #23340

    braddalton
    Participant
    Post count: 9743

    The add something like this to your child themes style.css file:
    [css]
    .post-37615 h1 {
    text-align: center;
    }
    [/css]

    Or custom class

    [css]
    .custom-class h1 {
    text-align: center;
    }
    [/css]


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #23342

    lisaleague
    Participant
    Post count: 32

    Just tried, the post id on the home page and that worked great! Seems like a good solution for a few pages.

    If a lot of pages/posts and I use the custom body class, can I use it for only the h1, leaving everything else the same, say for example on different layouts?

    #23345

    braddalton
    Participant
    Post count: 9743

    You can use any of the classes WordPress generates by default which you’ll see in the source code or create a custom class for each or use the page/post i.d’s.
    [html]
    body class="page page-id-4289 page-template-default logged-in admin-bar no-customize-support custom-background custom-header content-sidebar metro-custom
    [/html]

    Maybe you want to use a custom page template then use that class as your selector:
    [css]
    .page-template-default h1 {
    text-align: center;
    }
    [/css]


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.