如果我没有解释清楚,很抱歉。我正在使用WP PostRatings,它具有以下功能:
<?php if (function_exists(\'get_most_rated\')): ?>
<ul>
<?php get_most_rated(); ?>
</ul>
<?php endif; ?>
将代码放入模板页面会显示按用户评分列出的热门帖子的链接列表,但不会显示我想要的每个帖子的全部内容。我认为我需要进入循环或为此函数创建自定义查询?例如,我制作了一个自定义页面模板来显示我所有帖子的列表,但使用插件的功能进行此操作会让我迷失方向。如何使用此get_most_rated();
功能,因此它使用WP PostRatings功能并将最高级别的帖子显示为完整内容?
<?php
// set up or arguments for our custom query
$paged = ( get_query_var(\'paged\') ) ? get_query_var(\'paged\') : 1;
$query_args = array(
\'post_type\' => \'post\',
\'post_status\'=>\'publish\',
\'posts_per_page\' => 11,
\'paged\' => $paged
);
// create a new instance of WP_Query
$the_query = new WP_Query( $query_args );
?>
<?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); // run the loop ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(\'group post-standard\'); ?>>
<div class="post-inner">
<div class="post-thumbnail">
<a href="<?php the_permalink(); ?>">
<?php if ( has_post_thumbnail() ): ?>
<?php hu_the_post_thumbnail(\'beatpost-thumb\'); ?>
<?php elseif ( hu_is_checked(\'placeholder\') ): ?>
<img src="<?php echo get_template_directory_uri(); ?>/assets/front/img/thumb-standard.png" alt="<?php the_title(); ?>" />
<?php endif; ?>
<?php if ( has_post_format(\'video\') && !is_sticky() ) echo\'<span class="thumb-icon"><i class="fa fa-play"></i></span>\'; ?>
<?php if ( has_post_format(\'audio\') && !is_sticky() ) echo\'<span class="thumb-icon"><i class="fa fa-volume-up"></i></span>\'; ?>
<?php if ( is_sticky() ) echo\'<span class="thumb-icon"><i class="fa fa-star"></i></span>\'; ?>
</a>
<?php if ( comments_open() && ( hu_is_checked( \'comment-count\' ) ) ): ?>
<a class="post-comments" href="<?php comments_link(); ?>"><span><i class="fa fa-comments-o"></i><?php comments_number( \'0\', \'1\', \'%\' ); ?></span></a>
<?php endif; ?>
</div><!--/.post-thumbnail-->
<div class="post-content">
<h2 class="post-title entry-title">
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
</h2><!--/.post-title-->
<div class="beat-share"><span class="beat-social-button-fb"><a href="javascript:void(0);" onclick="PopupCenter(\'https://www.facebook.com/sharer.php?u=<?php the_permalink();?>&t=<?php the_title(); ?>\', \'myPop1\',531,545);"><i class="fa fa-facebook"></i></a></span> <span class="beat-social-button-twit"><a href="javascript:void(0);" onclick="PopupCenter(\'https://twitter.com/share?text=<?php the_title();?>>> Buy and Download Hundreds of Rap Beats&via=RockItPro&hashtags=buyrapbeats&url=<?php the_permalink();?>\', \'myPop1\',539,253);"><i class="fa fa-twitter"></i></a></span></div>
<div class="entry excerpt"><?php the_content(); ?></div>
<div class="post-meta group">
<p class="post-byline" style="display:none;"><span class="vcard author"><span class="fn"><a href="https://www.rockitpro.com/author/Sho-Down/" title="Posts by Sho-Down" rel="author">Sho-Down</a></span></span></p><p class="post-category"><?php the_category(\', \'); ?></p><p class="post-date date updated published"><i class="fa fa-angle-double-right"></i><?php the_time(\'m/d/Y\'); ?><span class="anglemobile"><i class="fa fa-angle-double-right"></i></span></p><p class="cat-posts"><a href="<?php comments_link(); ?>"><span><i class="fa fa-comments-o"></i> <?php comments_number( \'0\', \'1\', \'%\' ); ?><span class="comment-text"> Comments</span></span></a></p>
</div><!--/.post-meta-->
</div><!--/.post-content-->
</div><!--/.post-inner-->
</article><!--/.post-->
<?php endwhile; ?>
<div id="navigation">
<?php $big = 999999999; // need an unlikely integer
echo paginate_links( array(
\'base\' => str_replace( $big, \'%#%\', esc_url( get_pagenum_link( $big ) ) ),
\'format\' => \'?paged=%#%\',
\'current\' => max( 1, get_query_var(\'paged\') ),
\'mid_size\' => 2,
\'end_size\' => 1,
\'total\' => $the_query->max_num_pages
) ); ?>
</div>
<?php else: ?>
<article>
<h1>Sorry...</h1>
<p><?php _e(\'Sorry, no posts matched your criteria.\'); ?></p>
</article>
<?php endif; ?>
</div><!--/.hu-pad-->
</section><!--/.content-->
<?php get_sidebar(); ?>
<?php get_footer(); ?>