Cant View Posts in Homegrown Theme
-
Hi All
First post to this forum so all help appreciated.
I have created a very basic WordPress theme for a site I am working on (my first effort hold the applause till you read on).
I used a static page for the front page and used the iinclude_page plugin to put page content in some locations. So basically I have an index.php, header.php, footer.php as my main components on the site and it looks acceptable for the moment. However when I put the following code into my page
<ol id="whats-new"> <? $news=$wpdb->get_results("SELECT <code>ID</code>,<code>post_title</code> FROM $wpdb->posts WHERE <code>post_type</code>=\"post\" AND <code>post_status</code>=\"publish\" ORDER BY post_date DESC LIMIT $how_many"); foreach($news as $np){ printf ("<li><a href=\"index.php?p=%s\">%s</a></li>", $np->ID,$np->post_title); }?> </ol>
This code shows up the most recent posts (in the footer at the moment= but when you click on it to my latest posts it just bounces me back to the main page. Alternatively when I put a permalink in it still does not display the post but brings me back to the main page.
Ideally I would like just to have a link called blog which goes to the above them with the posts chronologically ordered in as if they laned on a starting WP page. Using the Settings -> Reading -> Posts to change it does not work for me.
The site is https://demo.grangewebdesign.com
Am I making a basic mistake somewhere? Well of course I am but all help appreciated.
- The topic ‘Cant View Posts in Homegrown Theme’ is closed to new replies.