• Tom

    (@rockstar_tom)


    Hello,

    Any idea how to add a ‘Recent News’ title to appear at the top of my latest posts page?

    Thanks,

    Tom

Viewing 6 replies - 1 through 6 (of 6 total)
  • Could you be more descriptive… ?

    What is your “latest posts page”?

    S.

    Thread Starter Tom

    (@rockstar_tom)

    Hi,

    The site is:
    https://www.hellotank.com/dev/vatcapital

    I have created a static page through WP admin called ‘News’. In settings I have selected this page to be my posts page. Does that help?

    I want to add a title as on the About Us page. Thanks for the help.

    Tom

    Ok.

    By “static page” you mean that you created a “wordpress page” in wp-admin

    Then, you have set this page as your home page.

    Question : did you make a page template with a special loop to display some posts ?

    S.

    Thread Starter Tom

    (@rockstar_tom)

    I created a ‘wordpress page’ in wp-admin called ‘News’, then in settings I went to the reading options and in the ‘Front page displays’ panel I selected to use a Static page. I left the ‘Front page’ option unchanged and set the ‘Posts page’ to be my newly created ‘News’ page.

    Does that make sense?

    Cheers, Tom

    Yes… it totally makes sense! ??

    Ok do you have a “home.php” file in your theme directory ?

    If no, make one. You can backup “index.php” and rename it “home.php”, then upload it in your theme directory. Be careful : don’t delete index.php from your theme directory. You could still need “index.php” for other purpose…

    Now that you have these two files, open home.php in a decent text editor.

    Find the start of the loop, you’re looking for that :

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    So, before the loop, write the title you want for your page… You’ll probably want to imbed it in some styling… Here, I put it in a h2 heading…

    <h2>Recent news</h2>

    You can of course style it as you wish, in a div called “page_title” or anything you like… But you have the principle…

    Now, WordPress will use “home.php” to display your home page and the title will be displayed before the posts, i.e. the loop…

    S.

    Thread Starter Tom

    (@rockstar_tom)

    Awesome!

    You have good karma heading your way. If our paths ever cross, I’ll buy you a beer or two. Thanks a lot for your help.

    Tom

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Add title to latest posts page’ is closed to new replies.