Support » Plugin: WordPress Popular Posts » [Plugin: WordPress Popular Posts] Define A Query For The "WordPress Popular Post

  • hi everybody,
    i want to write a query for the “WordPress Popular Posts” plugin because i want use it by

    and my reason is i want to define different styles (different backgrounds and other styles) for each titles that will be show…

    for example i defined these code for most comments:

    <?php query_posts('post_type=post&posts_per_page=10&orderby=comment_count&order=DESC');
    while (have_posts()): the_post(); $i++; ?>
    <?php  if($i%2 == 0) { echo "style='styles1'"; } else { echo "style='styles2'"; } ?>
    <a href="<?php the_permalink(); ?>" title="<?php printf(esc_attr('Permalink to %s'), the_title_attribute('echo=0')); ?>" rel="bookmark"><?php the_title(); ?></a>
    <?php endwhile; wp_reset_query(); ?>

    help me, please…

Viewing 15 replies - 1 through 15 (of 21 total)
  • anybody doesn’t have idea?

    really nobody?

    topic up 🙁

    Posted 2 weeks ago, o m g !

    guys, please help me, please.

    hi, i want to be able to sort by views using wordpress’ query_posts too.

    Plugin Author Héctor Cabrera


    The OP was about adding a different CSS style to each post. What does that have to do with sorting posts by views (which my plugin already does, btw)?

    and how do you do that? it’s not documented
    on the first post he’s sorting using comment_count and not views count

    Plugin Author Héctor Cabrera


    The sample code posted on the OP has nothing to do with my plugin. It’s using the query_posts function to retrieve posts with most comments. If you want to sort them by views, you have to use the WordPress Popular Posts plugin as WordPress does not store the views info natively (hence the reason why my plugin exists).

    If you are using it already, then you can find out how by taking a look at the FAQ section:

    What are the parameters that the wpp_get_mostpopular() template tag and the [wpp] shortcode accept? You can find a complete list of parameters via wp-admin > Settings > WordPress Popular Posts under the section “What attributes does WordPress Popular Posts shortcode [wpp] have?”

    There you will find the order_by parameter and its usage.

    Please don’t revive old posts and specially if what you need to ask has nothing to do with the OP. Creating a new thread would be a better idea.

    but the shorttag does display the results and what i want is a list of the posts that can be queried with query_posts and be able to do a “post loop” with it

    Plugin Author Héctor Cabrera


    Again, sorting by views isn’t possible using the query_posts function. WordPress doesn’t store how many times a post has been viewed so there is no way to achieve what you want. You need to use my plugin for that.

    but the plugin doesn’t do that neither ^^
    like i said it display the results using a template and instead of that i would like to be able to have an array of results

    where is akismet ?

    do you think you’ll add this feature in a future version ?

    Plugin Author Héctor Cabrera


    If you’re talking about having the plugin return an array of results instead of HTML, then yes. I have already implemented that on the development version which should be available soon.

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘[Plugin: WordPress Popular Posts] Define A Query For The "WordPress Popular Post’ is closed to new replies.