WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Popular Posts
[Plugin: WordPress Popular Posts] Define A Query For The "WordPress Popular Post (22 posts)

  1. Mr.vAhiD.DI
    Member
    Posted 2 years ago #

    hi everybody,
    i want to write a query for the "WordPress Popular Posts" plugin because i want use it by
    $i++;

    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>
    </div>
    <?php endwhile; wp_reset_query(); ?>

    help me, please...

    http://wordpress.org/extend/plugins/wordpress-popular-posts/

  2. Mr.vAhiD.DI
    Member
    Posted 2 years ago #

    anybody doesn't have idea?

  3. Mr.vAhiD.DI
    Member
    Posted 2 years ago #

    really nobody?

  4. Mr.vAhiD.DI
    Member
    Posted 2 years ago #

    topic up :(

  5. Mr.vAhiD.DI
    Member
    Posted 2 years ago #

    Posted 2 weeks ago, o m g !

  6. Mr.vAhiD.DI
    Member
    Posted 2 years ago #

    guys, please help me, please.

  7. madri2
    Member
    Posted 2 years ago #

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

  8. Héctor Cabrera
    Member
    Plugin Author

    Posted 2 years ago #

    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)?

  9. madri2
    Member
    Posted 2 years ago #

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

  10. Héctor Cabrera
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  11. madri2
    Member
    Posted 2 years ago #

    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

  12. Héctor Cabrera
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  13. madri2
    Member
    Posted 2 years ago #

    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

  14. madri2
    Member
    Posted 2 years ago #

    where is akismet ?

  15. madri2
    Member
    Posted 2 years ago #

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

  16. Héctor Cabrera
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  17. madri2
    Member
    Posted 2 years ago #

    nice thanks

  18. fabusdr
    Member
    Posted 2 years ago #

    Hi Héctor,
    your plugin is great, but it would be really usefull to get an array of popular posts that I can succesively style as I want. Ideally, one should be able to access all the post informations, for exemple authors, excerpt, categories, etc.
    Hope you'll rrealese a new version soon!
    again thank you very much for your help
    Fab

  19. Héctor Cabrera
    Member
    Plugin Author

    Posted 2 years ago #

    Hi guys,

    Tried to add that feature but unfortunately ran into unexpected issues so it won't be added anytime soon. For the time being, the Custom HTML Markup functionality will be your only way to customize the HTML output until I can come up with a different solution.

  20. fabusdr
    Member
    Posted 2 years ago #

    Hola Héctor,
    thank you very much for the update, I appreciate and I understand you can't do everything.
    In any case I hope you'll implement this feature one day, it would made your plugin much more flexible. For example it would be possible to filter the current language to display the popular posts with wpml.
    By the way, wpml it's much more stable than a couple of years ago. If in your plugin you use wp api instead of low level database queries, the result will be automatically filtered by wpml. So, another feature I'd love to see implemented.
    Sure, it's just an idea, some food for thoughts for a possible TO DO list.
    Again thank you very much for your great work!
    cheers
    Fab

  21. Héctor Cabrera
    Member
    Plugin Author

    Posted 2 years ago #

    Hi fabusdr,

    A long time ago I added support for WPML so my plugin would retrieve the translation properly. However, I assume it isn't working because otherwise you wouldn't have suggested that ^^ I promise to take another look at WPML and see what I can do.

    About the other feature, that is something I want to achieve since it'd be a lot easier for end user to do whatever they want with the results returned by the function. So, that'll stay in the TODO list, too.

    Thanks for commenting!

  22. fabusdr
    Member
    Posted 2 years ago #

    Great, thank you so much!
    Yes, popular posts shows every language instead of the current language as it should. I've read all the old posts you wrote on wp support and wpml forum, and this is way I started this slightly off topic conversation, sorry for that.
    If you need any helps testing wpml with your plugin please let me know and I'll do my best. I'm not a good programmer but I'm sure I can help. Also, the guys behind wpml are very friendly and usually helps people who wants to make plugins compatibles with wpml. If you contact them I'm sure they'll help.
    Again, thank you very much for your great work and for those 2 features in your todo list.
    cheers
    fab

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic