Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Wordpress : $query->have_pages ?

  • 05-03-2012 07:45PM
    #1
    Banned (with Prison Access) Posts: 36


    I want to check and get all pages like post

    $query = new WP_Query('showposts='.$slidernum.'&cat='.$slider_cat_id.'');

    $query->have_posts()
    $query->the_post()


Comments

  • Registered Users, Registered Users 2 Posts: 16,415 ✭✭✭✭Trojan


    Do you have a question?


  • Banned (with Prison Access) Posts: 36 mhkdeveloper


    $query->have_pages() this is not working.
    So I just ask any other option like this.


  • Registered Users, Registered Users 2 Posts: 6,652 ✭✭✭daymobrew


    I want to check and get all pages like post

    $query = new WP_Query('showposts='.$slidernum.'&cat='.$slider_cat_id.'');

    $query->have_posts()
    $query->the_post()
    The WP_Query docs says that showposts is deprecated and that you should use posts_per_page.

    Other than that the functions you list look right. See a WP_Query example.

    If you are still having problems, hard code values for $slidernum and $slider_cat_id to ones that you know should return results.

    Post more of your code if it is still not working.


  • Banned (with Prison Access) Posts: 36 mhkdeveloper


    Its worked like this

    $query = new WP_Query('showposts='.$slidernum.'&cat='.$slider_cat_id.'&post_type=page');


Advertisement