Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 825 Vote(s) - 3.51 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wordpress query from Magento/WHMCS return wrong result

#1
I am trying to display posts from a specific cateogry in WordPress in a footer column on a site. It works fine unless the footer is displaying on a page that is integrated in either WHMCS or Magento. For some reason, on those pages within those apps, it still displays the blog post column, but instead of returning the last X # of posts in the specified category, it seems to return the last post X # of times.

For example, here is the stand alone Wordpress blog column pulling from a specific category:

[To see links please register here]


This is exactly what we want shown throughout the site, however if you visit

[To see links please register here]

you can see that the middle column is not displaying that info.

Here is the code querying wordpress:





> define('WP_USE_THEMES', false);
> require('/home/shovels/public_html/blog/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 );

I'm not sure if I have done something wrong here, or if there is a better way to approach this, but it seems that WHMCS and Magento break something with these queries.

Any tips/advice appreciated! Thanks.


Reply

#2
Instead of `query_posts` try to use `get_posts` instead.



According to the article from [Developer.WordPress.com][1] you should avoid using query_posts.


[1]:

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through