WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Plugin: WordPress Popular Posts] Template does not work in v2.0 (72 posts)

  1. mpiftex
    Member
    Posted 4 years ago #

    After the update to v2.0, the hard code <?php get_mostpopular(); ?> does not work any more (Function does not exist). Is it possible to still add it to the template and not through the widget?

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

  2. Héctor Cabrera
    Member
    Posted 4 years ago #

    There's an alternative: the [wpp] shortcode. With it, you can still embed the listing in your blog's pages. If you need to insert it somewhere else (eg. on the sidebar, on the footer) you need to make your current theme widget-ready so that my plugin can be inserted where you want it to be.

    I rewrote the entire plugin to make it compatible with future versions of WordPress and also to give it multi-widget capabilities (as I announced here). This change implied some heavy modifications in my code to make it work under WordPress Widget Coding standards, which forced me to temporarily exclude that function from my plugin until I figure out a better way to implement it again (maybe a separate plugin for those who don't want to use my plugin as a widget).

    I realize this can be a bit problematic for some people, so I apologize for the inconvenience this might cause you.

  3. AutoKwame
    Member
    Posted 4 years ago #

    Please create a separate plugin for those who can't use the plugin as a widget. As with mpiftex, it's not working for me. I want to put it into a tabbed sidebar, but I just don't know how to do it.

    It will be really appreciated.

  4. mpiftex
    Member
    Posted 4 years ago #

    Thanks for the reply Ikki24 and thanks for all the time and effort you've put into the plugin, it's really appreciated.

    I really hope that in some point you'll add this function again. I'm not a fan of widgets (I like to have full code control) and since I want the Popular posts list in the sidebar so for now I downgraded back to 1.5.1.

    AutoKwame, I don't think it's possible to put it in a tabbed sidebar as a widget. Although I'm not completely sure. I know it is not suggested but maybe you should downgrade too (and keep you're site intact) until a solution is found.

  5. Masherwp
    Member
    Posted 4 years ago #

    Sorry but its also broken the custom widget on the wpnow elements theme
    Fatal error: Call to undefined function get_mostpopular() in /home/topper/public_html/wp-content/themes/elements/functions.php on line 63

    That line is

    <?php get_mostpopular(); ?>

    So I have also reverted back to 1.5.1

  6. Truth
    Member
    Posted 4 years ago #

    I don't use widgets as well so I hope you will be adding the original function back again. Will be sticking to 1.5.1 now.

    Thanks! :)

  7. QAsker
    Member
    Posted 4 years ago #

    Ikki24, thanks for all of your hard work!

    But please-please-please, return the hard code support :(( I also don't use widgets and this code is the only way i can use your plugin.

    You see, people don't use widgets not only because their themes aren't widget-ready. Even if they use old theme, it's very easy to make widget support.
    Actually, i and all my friends don't use widgets because of performance issues - wordpress widgets make significant server load and the very first step in wp optimization - is to disable widgets. It's better for cpu, caching and etc.
    So, without hard code we couldn't use your great plugin (and it's really the best).
    Sticking to 1.5.1 with hope for the hard code-supported version....

  8. MacMacken
    Member
    Posted 4 years ago #

    The 2.0 upgrade description did not contain any hint that the template usage would no longer work. Why do you want to force me to use a widget???

  9. Ginchen
    Member
    Posted 4 years ago #

    Too bad!

    I just wanted to install this plugin, but it's of no use to me if it doesn't provide a template tag, since I want to add it to my site's footer in a rather customized way.

    Please (re?)add this functionality! :)

  10. eladear
    Member
    Posted 4 years ago #

    I've been using this plugin for more than a year on the front pages of my site, not on sidebar. And I'd really like to be able to use <?php get_mostpopular(); ?> again or else the plugin is no use to me too.

    Thanks.

  11. eladear
    Member
    Posted 4 years ago #

    I've also kept it downgraded to version before 2.0. Oh well.

  12. MacMacken
    Member
    Posted 4 years ago #

    Is it somehow possible to disable to update notification for version 2.0?

  13. bwethington
    Member
    Posted 4 years ago #

    Alas, I am like the others here. I've disliked widgets from the beginning and find them far more trouble than simple hardcoding. The removed functionality means I have downgrade as well.

    Also, I've tried the [wpp] shortcode in a number of places and have yet to get it to work in any location (including my custom sidebar, footer, and in a post).

    While the shortcode seems like a good idea, it doesn't seem like an over useful feature for how this particular plugin would be utilized. Maybe I'm wrong on that one.

    Thank you for your effort and work on creating this plugin, but I am sad that the useful functionality for people that have utilized this plugin is now broken.

  14. Héctor Cabrera
    Member
    Posted 4 years ago #

    Thank you guys for your feedback!

    It seems that the shortcode was being used by a lot more people than I thought! I'll try a few ideas to get that function working again (I won't be re-adding the configuration page though, maybe will let you use parameters instead?).

    Gotta warn you guys that this might take sometime as my home PC is broken and haven't been able to fix it so the only chance I've got to test my code is while I'm at work - and that's a bit of a problem for me as I don't have much spare time while I'm there.

    Anyways, don't worry! It'll be re-added as soon as possible.

    bwethington, while the shortcode feature isn't something that gives my plugin a totally different level, it still could be useful for those who don't want to show their most popular entries on their sidebar or footer but on a single page.

    Also I believe that new features are, generally speaking, welcome so why not? ;)

    Once again, thanks for your feedback people! You make my plugin better!

  15. sam.psb
    Member
    Posted 4 years ago #

    Sorry to pile on, but I too was a user of the template tag. Just thought I'd mention it so you have an idea of how many people used this feature!

    It's a great plugin, so I'll be looking forward to the updated version. Thanks for your hard work.

  16. Gustave F. Gerhardt
    Member
    Posted 4 years ago #

    Where can I get 1.51? I too would like to revert as the plugin is now effectively broken for me.

    edit: nevermind, found it. Go to plugin page on wordpress and click "other versions"

  17. benstewart
    Member
    Posted 4 years ago #

    Can't you just use this:

    do_shortcode('[wpp]');

  18. Héctor Cabrera
    Member
    Posted 4 years ago #

    benstewart, brilliant!

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

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

  19. Héctor Cabrera
    Member
    Posted 4 years ago #

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

  20. Héctor Cabrera
    Member
    Posted 4 years ago #

    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!

  21. mpiftex
    Member
    Posted 4 years ago #

    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.

  22. Héctor Cabrera
    Member
    Posted 4 years ago #

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

  23. mpiftex
    Member
    Posted 4 years ago #

    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! :)

  24. mcbain7484
    Member
    Posted 4 years ago #

    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!

  25. Tim Moss
    Member
    Posted 4 years ago #

    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.

  26. Héctor Cabrera
    Member
    Posted 4 years ago #

    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!

  27. Truth
    Member
    Posted 4 years ago #

    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.

  28. Tim Moss
    Member
    Posted 4 years ago #

    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

  29. Héctor Cabrera
    Member
    Posted 4 years ago #

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

  30. Tim Moss
    Member
    Posted 4 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic