【问题标题】:Wordpress (Wordpress popular posts plugin) queryWordpress(Wordpress 热门帖子插件)查询
【发布时间】:2013-10-09 21:16:13
【问题描述】:

我可以使用吗:

<?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/

【问题讨论】:

    标签: php wordpress function post plugins


    【解决方案1】:

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

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-21
      • 1970-01-01
      • 2018-01-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多