greyisgood
Member
Posted 3 years ago #
I am trying to add the 10 most recent posts from my blog to the homepage of my website (a static html).
When I follow these instructions this is the output I get:
# get_results("SELECT ID,post_title FROM $wpdb->posts WHERE post_status= \"publish\" ORDER BY 'ID' DESC LIMIT ".$how_many); foreach($news as $np){ print ("ID); print ("\">$np->post_title
"); } ?>
I've tried various tweaks, all fail... Can anyone help me out, so I can update the codex page (tagged as needed edit)... quite a few having this same problem
greyisgood
Member
Posted 3 years ago #
really stuck with this one...
You can't do it with an HTML page. It needs to be a page that can take PHP (so use .phtml, .phtm, or .php). I'm not sure why that page in the codex lists all those pages that aren't capable of running PHP. The reason your page is simply rendering the PHP as text is because the server doesn't think a page with an HTML extension should run PHP scripts. Change it to .phtml and you should see a difference.
greyisgood
Member
Posted 3 years ago #
that works!
Thanks for your help on that one... there are some wrongers in the codex ;)