WordPress.org

Ready to get started?Download WordPress

Forums

WP-PostRatings
[resolved] Full Post of most popular with Numbering (8 posts)

  1. parapam
    Member
    Posted 8 months ago #

    Hello,

    Great plugin! Very enjoy using it!

    I'm using this code to display full post of most popular:

    <?php
    $popular_posts = new WP_Query("r_sortby=most_rated&r_orderby=desc&showposts=10");
    while ($popular_posts->have_posts()):
    $popular_posts->the_post();
    ?>
    <h4><?php the_title(); ?></h4>
    <?php the_content(); ?>
    <?php
    $i++;
    endwhile;
    wp_reset_query();
    ?>

    My question, is there is any way to add numbering Posts like 1, 2 ,3 ,4 etc.? Depending on how much posts are in Most popular.

    http://wordpress.org/plugins/wp-postratings/

  2. Lester Chan
    Member
    Plugin Author

    Posted 8 months ago #

    What numbering are you referring to?

    You can just print out $i?

    <h4><?php echo $i ?><?php the_title(); ?></h4>

  3. parapam
    Member
    Posted 8 months ago #

    Numbering posts like in image , but only numbering post which are in most popular page.

    Image

  4. parapam
    Member
    Posted 8 months ago #

    Sorry for double post, when I using <?php echo $i ?> , number one post not NR.1 , but just Nr. like in image.

    Image

  5. Lester Chan
    Member
    Plugin Author

    Posted 8 months ago #

    Sorry I don't think I am able to help you with this since it has nothing to do with the plugin. You might want to check with your theme author

  6. parapam
    Member
    Posted 8 months ago #

    thanks any way :)

  7. parapam
    Member
    Posted 8 months ago #

    Solved!

    If up code dont work for you try adding $i = 1; to :

    <?php $i = 1; while (have_posts()) : the_post(); ?>

    And then how Lester wrote

    <h4><?php echo $i ?><?php the_title(); ?></h4>

  8. Lester Chan
    Member
    Plugin Author

    Posted 8 months ago #

    I thought $i is in your code but not in the snippet you pasted because at the end you did increment $i++

Reply

You must log in to post.

About this Plugin

About this Topic