• Hello,

    I would like to ask for any assistance with regards to displaying ALL most viewed posts generated by the plugin.

    I made a list of most viewed posts using the short-code [tptn_list]. If I’m not mistaken, the plugin only accepts a minimum of 0 as the number of posts to display. I’d like to display ALL posts (just like some other plugins or the default WordPress function that if you set the number of posts to “-1” then it will display all posts) I’d like to do that and also I’d like to set a POSTS PER PAGE or better yet an INFINITE SCROLL with a LOAD MORE button (just like in this webpage https://www.thepublicdiary.com/stories/) so that the page won’t load ALL the most viewed posts at once.

    Thank you for any assistance or solutions you may provide.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Ajay

    (@ajay)

    Please see this implementation which is a custom code of using Top 10 with Ajax Load More plugin

    https://gist.github.com/ajaydsouza/690784c903242397a351

    You can set the “limit” to a very huge number like 9999999 which will just pull out all the posts in one shot and then do the infinite loading.

    Thread Starter Dustin Yulo

    (@dustin00)

    Hi Ajay,

    I’ve implemented the code you’ve shown me and it works fine but I want to get the styles and other meta information applied to the posts generated by the short-code [tptn_list] because our current short-code only displays title, image, date posted and post excerpt unlike the posts generated by the short-code [tptn_list] which also displays author and views count.

    • This reply was modified 7 years, 9 months ago by Dustin Yulo.
    Plugin Author Ajay

    (@ajay)

    If you’re using Ajax Load More, check out this page: https://connekthq.com/plugins/ajax-load-more/docs/repeater-templates/

    You should be able to use the modify the template to display the author. To get the views you can use: echo get_tptn_post_count(); which I think might work with the template

    Thread Starter Dustin Yulo

    (@dustin00)

    Hi Ajay,

    echo get_tptn_post_count(); doesn’t seem to work and only displays a value of “0” but then I used the tptn_shortcode_views(); function and now it works perfectly. But can I ask if using this function is correct or is it a bad implementation? I want to make sure that I did right to prevent future problems.

    Please visit This Link to check the actual output.

    Plugin Author Ajay

    (@ajay)

    That should work. I don’t intend to do anything to that function.

    You could also directly use
    get_tptn_post_count_only( get_the_ID(), 'total' );

    I like the implementation of the way you’ve done it. Would you be able to provide the full code? I’d like to add it to the gist above.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Display ALL posts’ is closed to new replies.