Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Wordpress : $query->have_pages ?

Options
  • 05-03-2012 7: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 Posts: 16,413 ✭✭✭✭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 Posts: 6,501 ✭✭✭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