• Hey,

    Currently when my users arrive to my site, they are greeted with a default static page that introduces my non-profit company. There are different sub sections as well.

    Currently, there is an area that mentions the latest blog title and a link to that post. I’m assuming instead of manually editing this page, there is some sort of code I could use to automatically pull this information each time and update the page without me having to do so.

    How could I get this to work? I know it would be similar to the widget that displays X amount of posts, but haven’t figured out what file that code is stored in yet. If someone could point me in the right direction, that would be great.

    Thanks!

Viewing 1 replies (of 1 total)
  • <?php $latest = new WP_Query(); $latest->query('showposts=1'); while($latest->have_posts()) : $latest->the_post(); $wp_query->in_the_loop = true; $latest_ID = $post->ID; ?>

    insert that above your <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a> (put above <div> if it has one)

    you can see the ('showposts=1'), there you can set how many latest posts you want to display

Viewing 1 replies (of 1 total)
  • The topic ‘Displaying Latest Blog Title/Link’ is closed to new replies.