Is there a function conflict

  • Bloke

    #7841

    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.

    Admin

    Syahir Hakim

    #39521

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

    Bloke

    #39522

    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">
    <?php
    $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;

    wp_reset_query();

    ?>
    </select>
    Admin

    Syahir Hakim

    #39523

    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?

    Bloke

    #39524

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

    Bloke

    #39525

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

    Admin

    Syahir Hakim

    #39526

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

    Bloke

    #39527

    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?

    Admin

    Syahir Hakim

    #39528

    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.