首页 > 解决方案 > 我可以使用 get_posts() 从 WP-PostRatings 和 WP-PostVevs 插件获取页面吗?

问题描述

我使用 WP-PostRatings WP-PostViews 插件并且能够使用函数显示页面

<?php if (function_exists('get_highest_rated')): ?>
   <ul><?php get_lowest_rated(); ?></ul>
<?php endif; ?>
<?php if (function_exists('get_most_viewed')): ?>
   <ul><?php get_most_viewed(); ?></ul>
<?php endif; ?>     

但它们显示为纯文本,我无法编辑它们,添加帖子的缩略图并做其他事情是否可以不显示它们,就像使用 get_posts() 这样

<?php 
global $post;
$args = array(
    'post_type' => 'post',
    'orderby' => 'comment_count',
    'order'=> 'ASC'
);
$myposts = get_posts( $args );
foreach( $myposts as $post ){ setup_postdata($post);?>
  <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
  <?php } wp_reset_postdata(); ?>       

但仅用于评分和观看次数

标签: wordpress

解决方案


推荐阅读