• I am trying to position the page title in a different place on a page to that on a post.
    I am already using the code:

    <h1 class="entry-title">
      <?php if ( ! is_front_page() ) { the_title(); } ?>
    </h1>

    to remove the title completely from the home page.
    So I need to somehow combine conditions so that I can add a class or id to the h1 tag for posts only, then I can use css to position it. But I can’t work out how to add the necessary code to the above in order to do this.
    Any help would be much appreciated.

    Kevin

Viewing 4 replies - 1 through 4 (of 4 total)
  • Kevin

    You can add css to the individual post id that can position the h1 tag. When you create a post, you can get the id number when in edit mode from the url and do something like:

    #post-11 h1 {
    margin-left: 40px;
    }

    or change the width, text-alignment, etc.

    Hope that helps.

    Thread Starter suddensway

    (@suddensway)

    Thanks Jeffery

    What I really need is for the position of the title on ALL the pages to be the same (which I’ve done through css), then the the position of the title on ALL the posts to be the same – yet in a different position to the pages. If that makes sense..? 🙂

    Kevin

    Thread Starter suddensway

    (@suddensway)

    I’ve found the following did the trick:

    body.single h1.entry-title  {
    margin-left: 40px;
    }

    Many thanks, you pointed me in the right direction

    Kevin

    I’m glad you found it, I had to go to sleep. 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Title in different position for pages and posts’ is closed to new replies.