I'd like page titles centred site wide especially for landing pages.

Is this possible without centring posts titles and everything else on the site?

  • I'm sorry, but this is really not feasible to answer. It will vary heavily from theme to theme. Please elaborate. – hampusn Oct 18 '12 at 11:51
  • This would be done in the style sheet, do you have a link to the site in question? – user22629 Oct 18 '12 at 12:33

Perhaps something like

$the_post_type = get_post_type( $post->ID );

switch ( $the_post_type ) {
    case 'page':
        // you'll need something else to distinguish "landing" pages from normal ones
        // which would allow you to then set a flag for it 

        if ( $some_condition ) $landing_page = true; 

        if ( $landing_page) {
            // display your title with the class that'll centre it

    case 'post':
    case default:
        // display your title with the normal class
| improve this answer | |

You could put this in your theme's style.css

h1.page-title {
    text-align: center;

Then make sure that in your theme's page.php you have one instance of the h1 tag with a 'page-title' class on it. For example:

<h1 class="page-title"><?php the_title(); ?></h1>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.