Wordpress Содержимое боковой панели повторяется - PullRequest
0 голосов
/ 26 февраля 2019

Я воссоздал новую боковую панель для этого сайта, и вы можете видеть, что она отлично работает на этой странице - http://dev.thehrdirector.com/features/

Однако, если вы нажмете на Архивы (http://dev.thehrdirector.com/features/archive/), вы увидитечто содержимое боковой панели повторяется снова и снова. Я абсолютно озадачен, поскольку обе страницы используют один и тот же код. Кто-нибудь может мне помочь?

Это код для страницы архива:

<?php get_header(); ?>

<main role="main" id="article-new">
    <section id="content" class="wrapper">
        <div class="main-col floatleft">
            <div class="title-bar uppercase white brandon">
                <a href="<?php bloginfo('rss2_url'); ?>?post_type=features" title="<?php _e('Syndicate this site using RSS'); ?>" class="floatleft"><img src="<?php echo get_template_directory_uri(); ?>/img/rss-feed.png" alt="RSS Feed" title="RSS Feed" /></a>
                <h1 class="floatleft"><?php _e( 'Features', 'html5blank' ); ?></h1>
                <div class="floatright">
                    More Articles: <a href="<?php echo site_url(); ?>/features" class="white">Latest</a> <a href="<?php echo site_url(); ?>/features-popular" class="white">Popular</a> <a href="<?php echo get_post_type_archive_link( 'features' ); ?>" class="white active">Archives</a>
                </div>
            </div>

            <?php $taxonomy = 'features_categories';
                $terms = get_terms($taxonomy);
                if ( $terms && !is_wp_error( $terms ) ) :
            ?>
                <ul class="archives freight">
                    <?php foreach ( $terms as $term ) { ?>
                        <li><a href="<?php echo get_term_link($term->slug, $taxonomy); ?>"><?php echo $term->name; ?></a></li>
                    <?php } ?>
                </ul>
            <?php endif;?>
        </div>

        <div class="right-col floatright">
            <?php get_sidebar('article'); ?>
        </div>
    </section>
</main>

и это код для боковой панели:

<aside class="sidebar" role="complementary">
<?php 
    if (have_posts()) : while (have_posts()) : the_post();

        if( have_rows('article_sidebar_content', 'option') ): 

            while ( have_rows('article_sidebar_content', 'option') ) : the_row();

            // LATEST NEWS
            if( get_row_layout() == 'latest_news' )
                get_template_part( 'partials/'. get_row_layout() );

            // ADVERTS
            if( get_row_layout() == 'ads' )
                get_template_part('partials/'. get_row_layout() );

            // LATEST SENIOR HR JOBS
            if( get_row_layout() == 'latest_senior_hr_jobs' )
                get_template_part('partials/'. get_row_layout() );

            // FEATURES
            if( get_row_layout() == 'features' )
                get_template_part( 'partials/'. get_row_layout() );

            // LATEST ROUNDTABLE REPORT
            //LATEST HR DIRECTOR INTERVIEW
            //LEGAL UPDATES
            //BLOG          
            if( get_row_layout() == 'misc' )
                get_template_part( 'partials/'. get_row_layout() );

            endwhile; 
        endif; 

    endwhile; endif; 
?>

1 Ответ

0 голосов
/ 26 февраля 2019

Можете ли вы проверить wp_reset_query () на боковой панели.

<?php 
query_post('post_type=post');
    if (have_posts()) : while (have_posts()) : the_post();

        if( have_rows('article_sidebar_content', 'option') ): 

            while ( have_rows('article_sidebar_content', 'option') ) : the_row();

            // LATEST NEWS
            if( get_row_layout() == 'latest_news' )
                get_template_part( 'partials/'. get_row_layout() );

            // ADVERTS
            if( get_row_layout() == 'ads' )
                get_template_part('partials/'. get_row_layout() );

            // LATEST SENIOR HR JOBS
            if( get_row_layout() == 'latest_senior_hr_jobs' )
                get_template_part('partials/'. get_row_layout() );

            // FEATURES
            if( get_row_layout() == 'features' )
                get_template_part( 'partials/'. get_row_layout() );

            // LATEST ROUNDTABLE REPORT
            //LATEST HR DIRECTOR INTERVIEW
            //LEGAL UPDATES
            //BLOG          
            if( get_row_layout() == 'misc' )
                get_template_part( 'partials/'. get_row_layout() );

            endwhile; 
        endif; 

    endwhile; endif; 
    wp_reset_query();
?>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...