Displaying the latest wordpress entries on my main page
-
Hey, I’m putting a blog on my webdev site, and I decided on wordpress.
You can take a look at https://www.mattramos.com/ to see what I’m trying to do. On the home page, I want to have 2 or 3 of the latest journal entries displayed in there. This is what I have now to grab the latest entry.
$latestentries = (“SELECT * FROM wp_posts ORDER BY id DESC LIMIT 1”);
$latestentriesresult = mysql_query($latestentries) or die(mysql_error());while($row = mysql_fetch_array($latestentriesresult)) {
$entrytitle = $row[‘post_title’];
$entrydate = $row[‘post_date’];
$entrycontent = $row[‘post_content’];
}mysql_query ($latestentries);
When I put in LIMIT 2 or LIMIT 3 in place of the 1, whenever I echo $entrytitle, it displays all of the past ones. The same thing happens when I echo any of the other variables. So, basically.. I’m asking if you guys can give me a better way, or something to add to my code to get this to work.
Other things I want to get up there eventually is a link to that entry, and I’m not sure how to do that either.
Thank you everyone ??
- The topic ‘Displaying the latest wordpress entries on my main page’ is closed to new replies.