Wordpress(Wordpress热门帖子插件)查询

时间:2021-11-29 06:41:56

Can I use:

我可以用吗:

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

Inside custom template (inside query posts) to make query with own template output:

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

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

Please help me with this, so I don't have to edit plugin and plugin's css while I have my ready just to query posts by this plugin.

请帮助我,所以我没有编辑插件和插件的CSS,而我已经准备好只是通过这个插件查询帖子。

Thanks.

谢谢。

Plugin: http://wordpress.org/plugins/wordpress-popular-posts/

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

1 个解决方案

#1


0  

@alen imeko as far as i have understoody your requirment, why you need this plugin, you just need to show the most popular post where ever you need to, You just need to set the post to sticky and call the sticky post using the same query post method then it will automatically render your specified post at the respective place. For this just go to post to make it sticky, at the top above the publish/update button you will see an option visibility click the edit part of it and you will the options will slide down check the checkbox having text Stick this post to the front page and after that you just need to perform query.

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


      $args =  array( 
    'post__in' => get_option('sticky_posts'),
    'posts_per_page' => 20,
    'orderby' => 'title',
    'post_date' => 'DESC',
    'cat' => your category id
    );

     query_post($args);
 ?>

Then you need to simply use the while loop for that the same way you do in wordpress.

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

#1


0  

@alen imeko as far as i have understoody your requirment, why you need this plugin, you just need to show the most popular post where ever you need to, You just need to set the post to sticky and call the sticky post using the same query post method then it will automatically render your specified post at the respective place. For this just go to post to make it sticky, at the top above the publish/update button you will see an option visibility click the edit part of it and you will the options will slide down check the checkbox having text Stick this post to the front page and after that you just need to perform query.

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


      $args =  array( 
    'post__in' => get_option('sticky_posts'),
    'posts_per_page' => 20,
    'orderby' => 'title',
    'post_date' => 'DESC',
    'cat' => your category id
    );

     query_post($args);
 ?>

Then you need to simply use the while loop for that the same way you do in wordpress.

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