Is there a function conflict

  • Bloke


    Is there any function in the theme that would conflict with a widget I am developing? I am looping through one category and listing all the post titles for that category. It only shows half of the list. I have 20 posts it shows 10.


    Syahir Hakim


    How did you get all the posts in one category? Using WP_Query()?



    I am developing a widget that will allow you to use a drop down to select from a list of posts from one category inside the admin area.

    <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Person of Month'); ?>:</label>
    <select name="<?php echo $this->get_field_name(''); ?>" id="<?php echo $this->get_field_id(''); ?>" class="widefat">
    $first_query = new WP_Query('cat=10&posts_per_page=-1');

    // The Loop
    while ( $first_query->have_posts() ) : $first_query->the_post(); ?>
    <option value=""><?php $first_query->the_post(). the_title() ?></option>
    <?php endwhile;



    Syahir Hakim


    Hurm.. nothing I can think of in the theme that would cause the issue you’re describing. Try switching to the default theme and see if the issue still persists?



    Yes its strange that it would show exactly half of the list of posts. I am thinking its a pagination issue.



    I switched themes and it still only shows exactly half of the list of posts.


    Syahir Hakim


    OK, then it’s probably a conflict with one of your plugins. Try disabling them?



    I turned off all my plugins and its still doing it. Is there something in the database that might save a setting I could check? Like a screen options setting?


    Syahir Hakim


    If you try this instead does it make a difference?

    $first_query = new WP_Query( array( 'cat' => 10, 'posts_per_page' => -1 ) );

Viewing 9 posts - 1 through 9 (of 9 total)

  • You must be logged in to reply to this topic.