WordPress.org

Ready to get started?Download WordPress

Forums

"Blog" page title is reading as the last post title on the page... (2 posts)

  1. Gr1f
    Member
    Posted 4 years ago #

    Hi.
    OK, here's my issue:
    I have created a page called 'blog' and set the 'posts page' in settings/reading/ to that page so i get all recent posts to that page. Thing is, the page Title
    <?php the_title(); ?>
    is pulling in the heading of the first post displayed on the page and not the page name 'my blog'.

    I also use:
    <body ID="<?php echo $post->post_name; ?>
    to make sure the page ID is taken from the page title, this is not working on the 'blog' page either.

    I tried a few different templates including default with no change.

    Any ideas?

  2. equalmark
    Member
    Posted 4 years ago #

    When you set WordPress to use a page for posts like you have done once that page is clicked on WordPress will use index.php in your theme as the template which displays things.

    Therefore if you want a title of blog at the top you would need to put this on that template.

    Put this before the loop and it should display:

    <?php if(is_home() ) { ?>
    <h1>Blog</h1>
    <?php } ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.