get_post on a static front page
-
I have wordpress installed to my domain’s root directory with a custom theme (still building it) and my blog is set to a page called blog.php, meaning that with permalinks, the link to my blog is https://www.dkoo.net/blog. The front page of my site is a static page set up via the wordpress “pages” feature, and gets its template from intro.php.
I want to have a “recent update” link on the static front page which leads to the latest single post. I found get_post and so far have this:
<?php
$postslist = get_posts(‘numberposts=1’);
foreach ($postslist as $post) : start_wp(); ?>” id=”post-<?php the_ID(); ?>”><?php the_title(); ?>
<?php the_date(); ?>
<?php the_excerpt(); ?>
<?php endforeach; ?>which should accomplish pretty much everything I need, as I understand. But it doesn’t actually grab the latest post. It just outputs a link to index.php, which loops back to intro.php, which is the page that I’m on. What am I missing? Any help would be greatly appreciated!
- The topic ‘get_post on a static front page’ is closed to new replies.