WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: WordPress Popular Posts] Template does not work in v2.0

[Resolved] [Plugin: WordPress Popular Posts] Template does not work in v2.0

Viewing 15 replies - 16 through 30 (of 71 total)
  • Can’t you just use this:

    do_shortcode('[wpp]');

    benstewart, brilliant!

    One question, though: is it possible to use parameters with that? For example, like this?:

    <?php do_shortcode('[wpp limit="10"]'); ?>

    To answer myself: yes, it can be done!

    So, for those of you who can’t wait till version 2.0.1 is out, you can embed WordPress Popular Posts using this code:

    <?php
    if (function_exists('do_shortcode')) {
      do_shortcode('[wpp]');
    }
    ?>

    … and if you wish to use parameters to customize it, simply do something like:

    <?php
    if (function_exists('do_shortcode')) {
      do_shortcode('[wpp range=today stats_comments=1 stats_views=1]');
    }
    ?>

    P.S.: you can find a complete list of available attributes via wp-admin > Settings > WordPress Popular Posts (version 2.0.0 only!!)

    Version 2.0.1 is out! You guys should be getting the Upgrade notice within the next hour or so.

    Please test it and let me know if you find anything not working as expected since I included a few updates on this release as well.

    Thanks in advance for your feedback!

    Hey Ikki24, thanks for dealing with this issue!
    I did update to v2.0.1 but now I’m having the same problem with the one mentioned here. The list appears empty and I get the “Sorry. No data so far.” message. I downgraded again and the list appears correctly as it did before (no stats were deleted). I checked the mySQL db and the table _popularpostsdata still has entries, the _popularpostsdatacache is empty.

    Can you please have another look at it?
    Thanks again.

    Hi mpfitex,

    I’ll try to explain that the best that I can (english isn’t my native language, so…) but first a brief summary of what’s going on with WPP 2.0:

    The _popularpostsdatacache is a new addition in 2.0. That table did not exist on any previous versions of my plugin. That’s why it’s empty, but it should start filling with data as soon as your visitors check your pages.

    Now, what does _popularpostsdatacache do? It’s purpose is to store all views in the last 30 days from the current date, after that the plugin will wipe out all registries that have been in that table for more than 30 days to avoid making the table too large. When someone visits any page of your post, my plugin will register that in both _popularpostsdatacache and _popularpostsdata (“cache” and “data” from now on).

    On the other hand, the data table will store all info about all those posts that have been in cache (some sort of a historical table). These entries will not be deleted automatically by my plugin (unless you wipe it out via wp-admin > Settings > WordPress Popular Posts).

    When you set Time Range to “daily”, my plugin will look for all records in the cache table and select those that have been viewed today. Something similar will happen if you select “weekly”, or “monthly”: the listing will be build from the information stored in the cache table. However, setting it to “all”, will make my plugin switch to the data table (_popularpostsdata) and extract all the info from there (that’s where are stored the recordings from version 1.5.1).

    If you have set Time Range to “daily” now, WPP will look into _popularpostsdatacache and there’s no information there yet – that table needs to be populated. That’s why you’re getting the “Sorry, no data so far” message.

    Allow me to suggest you to switch Time Range to “all” for a while (a couple of days would be enough if you want Time Range set to “daily”) so that the cache table is filled with data as your visitors check your pages.

    A long explanation, I know, but I wanted to make it clear enough for others who might read this thread 😉

    That was super-detailed! Thanks Ikki!
    I thought that the default value for the range would be “all”, as soon as I’ve added it, the posts appeared! Great!! I would suggest you to add the default values in the attribute list.

    For others who will use the function, here is my setup, with all the attributes that I’ve used:

    <?php if (function_exists("get_mostpopular")) get_mostpopular("header='Popular Posts'&header_start='<h4>'&header_end='</h4>'&range=all&order_by=views&limit=8&stats_comments=0&stats_views=0&wpp_start='<ul>'&wpp_end='</ul>'&post_start='<li>'&post_end='</li>'&pages=0"); ?>

    This code exports something like this:

    <h4>Popular Posts</h4>
    <ul>
    <li>Post name here</li>
    <li>Another post here</li>
    .....
    </ul>

    Once again, thanks Ikki for all the great work, for sticking behind your plugin and take into consideration the users’ desires! 🙂

    Thanks mpiftex! Your example helped me figure something out.

    Ikki24L Thank you for the quick 2.0.1 upgrade! Works great, I had been going a few days without it working because I use the template tag, and now it works!

    Ikki, many thanks for the pointer and swift upgrade.

    Mpiftex, thanks also for the code. However, even when I copy it directly into my Sidebar, it comes out different.

    1. It’s ordered by Comments rather than Views.

    I’ve got the “order_by=views” command and can tell it’s not because I can get it to display the number of Comments and/or Views.

    2. It doesn’t show up the bulleted list.

    Just text, no bullet points.

    Any suggestions?

    Thank you,
    Tim.

    Try removing the single quotes (‘) and let me know what happens.

    The shortcode functionality is also new to 2.0 so it might be a bit buggy. Your feedbacks will help make it better!

    Thanks so much for bringing this back!

    It’s working pretty well, I set it to “all” now as the rest doesn’t give me any data. Will set it back to weekly in a few days. It’s enough time right?

    I use this function by the way, no header and in a list:

    <?php if (function_exists("get_mostpopular")) get_mostpopular("range=all&order_by=views&limit=3&stats_comments=0&stats_views=0&wpp_start='<ul>'&wpp_end='</ul>'&post_start='<li>'&post_end='</li>'&pages=0"); ?>

    It’s modified from the one mpiftex posted above. Thanks mpiftex for providing us with an example of how to start.

    Thanks Ikki.

    Removed the quotes but no change I’m afraid. This is my code now:

    <?php if (function_exists("get_mostpopular")) get_mostpopular("header=MostPopularPosts&header_start=<h2>&header_end=</h2>&range=all&order_by=views&limit=8&stats_comments=0&stats_views=0&wpp_start=<ul>&wpp_end=</ul>&post_start=<li>&post_end=</li>&pages=0"); ?>

    Tim – http://www.thenextchallenge.org

    Weird. Have you tried Truth’s code already?

    <?php if (function_exists("get_mostpopular")) get_mostpopular("range=all&order_by=views&limit=3&stats_comments=0&stats_views=0&wpp_start='<ul>'&wpp_end='</ul>'&post_start='<li>'&post_end='</li>'&pages=0"); ?>

    Thanks Ikki. Just copied and pasted Truth’s code but same thing – no bullets and still ordered by Comments. Very strange!

    Can you please copy your theme’s code here (where you’re inserting the template tag) so I can examinate it? It’s hard to tell what’s happening without watching any code 🙁

Viewing 15 replies - 16 through 30 (of 71 total)
  • The topic ‘[Resolved] [Plugin: WordPress Popular Posts] Template does not work in v2.0’ is closed to new replies.
Skip to toolbar