• Hi everyone,

    I use wordpress as a CMS for my website. I find wordpress has been a complete revolution to my site and it works great.

    One question I have though, is I would like to have a link at the top of my page which links to the latest wordpress post.

    It would be very much appreciated if someone could please provide support with how to do this?

    Thanks in advance.

Viewing 6 replies - 1 through 6 (of 6 total)
  • I assume you designated a Page as the front page for your site. Create a Page called Blog and publish. Go to Settings-Reading and choose Blog as your blog page. If you have wp_list_pages in your navigation, Blog link will appear there.

    Thread Starter djt992

    (@djt992)

    Thanks for your reply. I don’t really think I explained it very well though.. I’ll try again.

    I basically want to display a hyperlink at the top of all the pages throughout my website which says something like “Have you read our latest article?” which then links to the latest wordpress post.

    Is this type of hyperlink possible?

    Thanks again.

    insert this somewhere at the top, ideally in your header.php

    <?php query_posts('showposts=1'); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    	<p><a href="<?php the_permalink(); ?>">Our latest article: <?php the_title(); ?></a></p>
    <?php endwhile; else: ?><p>no latest article!</p><?php endif; ?>

    @mores:
    Awsome! Thanks a lot, this is just what I needed!

    guillermovelasco

    (@guillermovelasco)

    Hi. Thanks for the solution, it works from the home, but i tryed it from a page or a post, and then it loads again the same page or post, not the last post.
    Thank in advance.
    Guillermo

    When I try this code, every page shows the latest post instead of what was intended.

    Is there perhaps some sort of “push state” and “pop state” functionality available for the WordPress engine?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Simple Question – Latest Post Link’ is closed to new replies.