WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Popular Posts
[resolved] [Plugin: WordPress Popular Posts] Template Tags NOT Working, But Widgets ARE (7 posts)

  1. Clyde
    Member
    Posted 1 year ago #

    Hello Héctor,

    I love the features of this plugin. You've done a great job providing multiple options for configuring Most Popular posts, but I do have a problem.

    I am trying to add the template tags into my theme, but I keep getting, "Sorry. No data so far."

    An example of code that I am using is:

    <?php if (function_exists('wpp_get_mostpopular')) wpp_get_mostpopular("header=Crafts&limit=5&range=monthly&order_by=views&post_type=craft&thumbnail_width=30&thumbnail_height=30"); ?>

    Most Popular posts are rendering correctly via the widget, but I require the use of template tags.

    Am I using the wrong code? I checked, checked and re-checked, but I don't notice any errors in the above template tag.

    Site: Crafts by Courtney

    Please help,

    Clyde

  2. Héctor Cabrera
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Clyde,

    Just tested your exact same code and it seems to be working fine here. Please open wordpress-popular-posts.php and change this line of code:

    jQuery.post('<?php echo admin_url('admin-ajax.php'); ?>', {action: 'wpp_update', token: '<?php echo $nonce; ?>', id: <?php echo $id; ?>}, function(data){/*alert(data);*/});

    ... into:

    jQuery.post('<?php echo admin_url('admin-ajax.php'); ?>', {action: 'wpp_update', token: '<?php echo $nonce; ?>', id: <?php echo $id; ?>}, function(data){ alert(data); });

    ... and save changes.

    Let me know what happens, then undo the change.

  3. Clyde
    Member
    Posted 1 year ago #

    Wow, thanks for the quick response Héctor. I made the change, but I am still receiving the, "Sorry. No data so far." error.

    Thank you again for help with this,

    Clyde

  4. Héctor Cabrera
    Member
    Plugin Author

    Posted 1 year ago #

    That code I posted it's supposed to show an alert, did it show? If so, what did it say?

  5. Clyde
    Member
    Posted 1 year ago #

    Hello Héctor,

    I added the code you've provide, but I didn't see any errors.

  6. Clyde
    Member
    Posted 1 year ago #

    Héctor,

    I think I may have resolved my issue. I have been using a PHP code widget (Linkable Title Html and Php Widget by PepLamb) and added the template tags there.

    They did not render properly, but when I added the template tags directly to the sidebar.php file, I saw content being rendered.

    It may take a bit more work on my part to work as I require, so I think it may be an issue with how the PHP code widget renders PHP template tags.

    Thank you for you help and quick responses Héctor.

    Regards,

    Clyde

  7. Héctor Cabrera
    Member
    Plugin Author

    Posted 1 year ago #

    Oh, I see. I forgot about that one. Long ago, other people reported this issue as well. I need to put this warning on the FAQ section.

    Thanks for letting me know!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic