WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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? – Samer Sultan 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
share|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>
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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