4

我可以用吗:

<?php
if (function_exists( 'wpp_get_mostpopular' )) {
  wpp_get_mostpopular('range=weekly&order_by=views&limit=8');
}
?>

在自定义模板内部(在查询帖子内部)使用自己的模板输出进行查询:

<?php query_posts(????????); ?>
<?php while (have_posts()) : the_post(); ?>
<div class="myclass">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php echo get_the_post_thumbnail( $post_id, 'thumbnail'); ?></a>
</div>

请帮我解决这个问题,这样我就不必编辑插件和插件的css,而我已经准备好通过这个插件查询帖子了。

谢谢。

插件:http ://wordpress.org/plugins/wordpress-popular-posts/

4

1 回答 1

0

@alen imeko 据我了解你的要求,为什么你需要这个插件,你只需要在你需要的地方显示最受欢迎的帖子,你只需要将帖子设置为粘性并使用相同的方式调用粘性帖子查询 post 方法,然后它将自动在相应的位置呈现您指定的帖子。为此,只需发布​​以使其具有粘性,在发布/更新按钮上方的顶部,您将看到一个选项可见性单击它的编辑部分,您将选项将向下滑动选中带有文本的复选框将此帖子粘贴到首页,然后您只需要执行查询。

      $args = 数组(
    'post__in' => get_option('sticky_posts'),
    'posts_per_page' => 20,
    'orderby' => '标题',
    'post_date' => 'DESC',
    'cat' => 您的类别 ID
    );

     query_post($args);
 ?>

然后你需要像在 wordpress 中一样简单地使用 while 循环。

于 2015-08-25T09:56:30.867 回答