samedi 9 mai 2015

How to display most viewed posts in custom post type

I'm using keremiya theme for wordpress. I was trying to display my most viewed post in my custom post type if "most_viewed" option is on. The name of my custom post type is watch. How can i do this with my current code? I am also using a plugin called wp-post views to display the views in my sidebar. Here is my query.

    <?php if(get_option('most_viewed') == 'On'): ?>
    <div class="sidebar-right">
    <h2><?php echo get_option('my_title'); ?></h2>
    <div class="fimanaortala">
    <?php $tavsayi = get_option('keremiya_tavsiyesayi'); $tavkat = get_option('keremiya_tavsiyekat');?>
    <?php query_posts('showposts='.$tavsayi.'&v_orderby=desc&cat='.$tavkat.'') ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <div class="filmana">
        <div class="filmsol">
        <?php keremiya_resim('80px', '70px', 'izlenen-resim'); ?>
        </div>
        <div class="filmsag">
            <div class="filmsagbaslik">
            <a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
            </div>
            <div class="filmsagicerik">
            <?php if(function_exists('the_views')) { the_views(); echo " "; } ?>
            <p><?php nezaman_yazildi(); ?></p>
            </div>
            <div class="filmizleme">
            <a href="<?php the_permalink() ?>"><img src="<?php bloginfo('template_directory'); ?>/images/filmizle.png" alt="film izle" height="21" width="61" /></a>
            </div>
        </div>
    </div>
    <?php endwhile; else: ?>
    <?php endif; ?>
    <?php wp_reset_query(); ?>
    </div>
</div>

Aucun commentaire:

Enregistrer un commentaire