WordPress category query from Magento/WHMCS returns wrong result
-
Hi,
I have a bit of code that queries a particular category in WordPress and returns the last 4 results. This works fine unless it is called from a page where it is integrated within Magento or WHMCS. In those cases, instead of pulling the results from the specified category, it seems to be querying the last post, and displaying it 4 times.
For example, here is the include file showing the wanted output:
https://www.thinkshovels.com/includes/latest_work.php but if you look here on a page where whmcs is in use, you see it pulls the latest post from wordpress instead, https://www.thinkshovels.com/service
Here is the code generating the posts to be displayed:
define(‘WP_USE_THEMES’, false);
require(‘wp-load.php’);$qarray = array(‘cat’ => ‘5’, ‘posts_per_page’ => 4);
query_posts($qarray);while (have_posts()): the_post();
$args = array(
‘post_type’ => ‘attachment’,
‘numberposts’ => -1,
‘post_status’ => null,
‘post_parent’ => $post->ID
);`Any help on what I need to do to get this to pull the correct content is much appreciated!
Thanks in advance.
- The topic ‘WordPress category query from Magento/WHMCS returns wrong result’ is closed to new replies.