0

I've browsed all the other questions that could be related to this and still can't find the answer. My code is only displaying the results of the loop in the first tab, but won't show it in the second tab. Can't figure out why. See code below:

<div class="tab-panels">
    <div class="panel entry-content active" id="tab_all-lines">
        <!-- Full Menu -->
        <?php
        $loop = new WP_Query(
            array(
                'post_type' => 'featured_item', 
                'post_status' => 'publish',
                'posts_per_page' => -1,
                'orderby' => 'title',
                'order' => 'ASC',
            )
        );?>
        <ul id="menu-manufacturers-all-lines" class="menu">
            <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
            <li class="menu-item menu-item-type-post_type menu-item-object-featured_item">
                <a href="<? the_permalink(); ?>"><? the_title();?></a>
            </li>
            <?php endwhile;?>
        </ul>
        <?php wp_reset_postdata(); ?>
    </div>
    <div class="panel entry-content" id="tab_lines-we-stock">
        <!-- Filter Menu -->
        <?php
        $loop_stock = new WP_Query(
            array(
                'post_type' => 'featured_item',
                'post_status' => 'publish',
                'posts_per_page' => -1, 
                'category_name' => 'lines-we-stock',
                'orderby' => 'title',
                'order' => 'ASC'
            )
        );?>
        <ul id="menu-manufacturers-all-lines" class="menu">
            <?php while ( $loop_stock->have_posts() ) : $loop_stock->the_post(); ?>
            <li class="menu-item menu-item-type-post_type menu-item-object-featured_item">
                <a href="<? the_permalink(); ?>"><? the_title();?></a>
            </li>
            <?php endwhile;?>
        </ul>
        <?php wp_reset_postdata(); ?>
    </div>
</div>
2
  • did you check the html output of the code in the browser?
    – Michael
    Apr 9 '20 at 3:23
  • Yes, not sure why this wouldn't work. Anyone spot anything wrong with my code?
    – Jason
    May 4 '20 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.