[Support request] Centering Headings

Home Forums Support [Support request] Centering Headings

Home Forums Support Centering Headings

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #946187
    Stuart

    Is there not a way to center headings in pages and posts? I haven’t seen an option for that and all the text automatically goes leftward.

    #946193
    David
    Staff
    Customer Support

    Hi there,

    we are looking at possibly adding them as Customizer options, if there is enough interest. But it takes 3 lines of CSS to currently do it:

    h1.entry-title {
        text-align: center;
    }
    #946230
    Stuart

    Thank you. How and where would I enter this code? And can it be used to center headings in some pages but not others?

    #946233
    David
    Staff
    Customer Support

    So you can add it to the Customizer > Additional CSS – and it will apply to all pages and posts.
    To set it to specific pages / posts you would need to specify the unique page-id / post-id for each one in the CSS. So simpler way is to:

    1. Create a new Hook Element:
    https://docs.generatepress.com/article/hooks-element-overview/

    2. Add this as your content:

    <style>
    h1.entry-title {
        text-align: center;
    }
    </style>

    3. Select the WP_head Hook from the Hook list

    4. On Display Rules set the posts / pages you wish it to work on. You can use taxonomies ( categories and tags ) if you like. Or set it to the Entire Site and then exclude the ones you don’t want it on.

    #946253
    Stuart

    What is the definition of a “hook”?

    #946274
    David
    Staff
    Customer Support

    Simple put it is a ‘placeholder’ left in the templates code – which allows a user to ‘hook’ in their own content.

    The WP_Head hook places the content / code inside the <head></head> of your website.

    #946502
    Stuart

    I see. Thank you.

    #946503
    David
    Staff
    Customer Support

    You’re welcome.
    The Theme has lots of Hooks, you can see the most commonly used ones for the various templates in this visual guide:

    https://docs.generatepress.com/article/hooks-visual-guide/

    #2067945
    Harry

    Hello GP Team, has centering headings been added to the new typography module, or does it still require custom CSS? I looked but didn’t see it.
    Harry

    #2067997
    Ying
    Staff
    Customer Support

    Hi Harry,

    text-align is not included in the typography settings.

    So CSS is still required.

    #2068022
    Harry

    OK, thanks. Easy to do.
    Harry

    #2068047
    Ying
    Staff
    Customer Support

    No problem 🙂

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.