• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

custom class

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › custom class

This topic is: not resolved

Tagged: custom class

  • This topic has 4 replies, 2 voices, and was last updated 10 years, 1 month ago by Brad Dalton.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • February 28, 2013 at 1:31 pm #23334
    lisaleague
    Member

    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/

    February 28, 2013 at 1:59 pm #23338
    Brad Dalton
    Participant

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

    Otherwise add a custom body class using the Layout Settings.


    Tutorials for StudioPress Themes.

    February 28, 2013 at 2:09 pm #23340
    Brad Dalton
    Participant

    The add something like this to your child themes style.css file:

    .post-37615 h1 {
       text-align: center;
    }
    

    Or custom class

    .custom-class h1 {
       text-align: center;
    }
    

    Tutorials for StudioPress Themes.

    February 28, 2013 at 2:18 pm #23342
    lisaleague
    Member

    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?

    February 28, 2013 at 2:41 pm #23345
    Brad Dalton
    Participant

    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.

    body class="page page-id-4289 page-template-default logged-in admin-bar no-customize-support custom-background custom-header content-sidebar metro-custom
    

    Maybe you want to use a custom page template then use that class as your selector:

    .page-template-default h1 {
       text-align: center;
    }
    

    Tutorials for StudioPress Themes.

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble