I’m trying to display an excerpt of the most recent blog post on the home page of my website. I’m doing this by putting this code at the top of the index.php:
<?php // Include WordPress define('WP_USE_THEMES', false); require('http://www.url.com/blog/wp-load.php'); query_posts('showposts=1'); ?>
When loading up index.php I get the error:
Fatal error: Call to undefined function query_posts() in /home1/chrisayr/public_html/projects/callumtoy/index.php on line 5
This code works when I have my index.php page at http://www.url.com, but if I put it in my desired location (www.url.com/projects/imac/index.php) then this problem occurs. Anyone know why this is, and how I can get around it?
- The topic ‘Why won't this query_posts work?’ is closed to new replies.