Help please, Showing best rating custom post
-
Hello everybody i want to display the best rated custom post i name them ‘bot’ on my own theme but i dont know how to do it.
this is what i have in the calling template part<?php $args = array( 'post_type' => 'bot' ); $query = new WP_Query( $args ); ?> <?php if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?> <div class="bot"> <div class="bot-content-top"> <p class="view"><?php the_views() ?><span class="glyphicon glyphicon-eye-open"></span></p> <div class="bot-image"> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"> <img src="<?php the_field('bot_image'); ?>"> </a> </div> <div class="bot-content-info"> <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> <h4><?php the_category( ' ' ); ?></h4> <p><a href="<?php the_permalink(); ?>"><?php echo wpt_excerpt_length(); ?></a></p> </div> </div> <div class="bot-content-bottom"> <div class="rating"> <p> <?php echo kk_star_ratings(); ?> </p> </div> <button class="btn btn-info" onclick="location.href='https://telegram.me/<?php the_field('bot_url'); ?>';" formtarget="_blank" value="add to">Add To <span class="glyphicon glyphicon-send"></span></button> </div> </div> <?php endwhile; endif; wp_reset_postdata(); ?>
<!– i tried this and didnt work for me –>
<?php query_posts('meta_key=_kksr_avg&orderby=meta_value&order=DESC'); ?>
<!– i tried also this and didnt work for me –>
<?php query_posts('post_type=bot&meta_key=_kksr_avg&orderby=meta_value&order=DESC'); ?>
Im very bad in php and dont know what to do, and I appreciate the help from anyone.
Thnak you in advance.
- The topic ‘Help please, Showing best rating custom post’ is closed to new replies.