I am trying to create a loop to display the title and excerpt of each blog post onto a page that isn’t my index page. The in-progress demo site is here: http://thewestharbour.com/mypakage/
On the news page I need to display the latest 3 blog posts. Simply changing the settings won’t work and every loop I have tried doesn’t work either. I have also tried creating a separate template and assigning it to the news page but had no luck.
Thanks, Wade
You can modify your post template (usually index.php, but depends on your theme) to:
The following code will query the database and return a string with the 5 latest posts with excerpts. Note the
$before
,$after
,$before_excerpt
,$after_excerpt
, these are just wrappers for the content to make it look nicer, you can send all these as a parameter to the function, but for the sake of simpleness, I hard-coded these.