社交媒体羽毛图标不为每个帖子显示

时间:2014-09-12 作者:terminator

我使用以下代码为每篇文章显示“社交媒体羽毛”小部件,但图标仅显示在第一篇文章中,其余部分则不显示:

$paged = (get_query_var(\'paged\' )) ? get_query_var(\'paged\') : 1;
$args = array( 
        \'post_type\' => \'events\',
        \'posts_per_page\' => 2,
        \'paged\' => $paged
);              
$loop = new WP_Query( $args );
if ($loop->have_posts()) : while ( $loop->have_posts() ) : $loop->the_post();   
    $count=0;
    ?>
    <div class="row event-list  my-events <?php echo $type[0]->name; ?> ">            
        <div class="col-lg-9 col-md-9 col-sm-8 col-xs-12 paddingdel-l">
            <h5><?php the_title( ); ?></h5>
            <div class="row">                             
                <div class="co-lg-5 col-md-5 col-sm-5 col-xs-6 event-list-right">                          
                    <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 paddingdel-l pad0">
                        <img src="<?php echo IMAGES; ?>/share.png" class="img-responsive" alt="" />
                    </div>
                    <div class="col-lg-8 col-md-8 col-sm-8 col-xs-8 social">                     
                        <?php get_sidebar(\'share\'); ?>
                    </div>
                </div>
            </div>                   
        </div>                
    </div>    
    <?php 
endwhile; endif;

1 个回复
最合适的回答,由SO网友:terminator 整理而成

用shortcode做的。而不是使用<?php get_sidebar(\'share\'); ?> 习惯于<?php echo do_shortcode(\'[feather_share]\' ); ?> 用于共享图标。我猜一个小部件只能在页面上显示一次

结束

相关推荐