WordPress.org

Ready to get started?Download WordPress

Forums

Post Views Count
[resolved] How To Sort Most/Least Viewed Posts in List (8 posts)

  1. FolkertD
    Member
    Posted 1 year ago #

    Great plugin, One question, can i sort my post by most/least viewed in my template list by using a variable in the URL?
    Was using WP postviews before this they something like; http://yoursite.com/posts/?v_sortby=views&v_orderby=desc

    Regards

    http://wordpress.org/extend/plugins/baw-post-views-count/

  2. Julio Potier
    Member
    Plugin Author

    Posted 1 year ago #

    Yes of course, do this :

    $orderby = $_GET['v_orderby']=='asc' ? 'asc' : 'desc';
    echo do_shortcode( "[most_views order=$orderby]" );
  3. FolkertD
    Member
    Posted 1 year ago #

    hi dont really know what to do with that, i am using a dropdown filter for the functions to sort the posts, this is the sort option for views i have now

    <?php if(preg_match('/v_sortby=views&v_orderby=desc/', $page_url)) {
    				_e('Views (Most)', 'gp_lang');} ?>

    <option value="<?php echo $review_url; ?>v_sortby=views&v_orderby=desc"><?php _e('Views (Most)', 'gp_lang'); ?></option>

  4. Julio Potier
    Member
    Plugin Author

    Posted 1 year ago #

    Can you paste me all the code of this page via pastebin.com ? Thank you

  5. FolkertD
    Member
    Posted 1 year ago #

    Yes sure, Thanks

  6. Julio Potier
    Member
    Plugin Author

    Posted 1 year ago #

    Ok but not enought, where is my shortcode ? where is the code which displays all posts ?
    Thanks

  7. FolkertD
    Member
    Posted 1 year ago #

    not sure what you mean, the review-list.php displays all the posts

  8. Julio Potier
    Member
    Plugin Author

    Posted 1 year ago #

    Damn, this is a big mess :/
    Who coded this ? This ocde is using a preg_match instead of a simple $_GET array, WTF ?
    Sorry, i can't fix it this time, too timeeater for me.

    "Resolved"

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags