• Resolved myntillae

    (@myntillae)


    The PHP code we’ve had on the site for several years all of the sudden stopped working. I went through the FAQ and don’t see any conflicts there with anything, so I’m stumped. Is it just because we’re using PHP code on a page template? The widget seems to work just fine except the widget isn’t coded to go into the particular section of the site.

    The plugin itself is showing data for the site, so I’m confused as to why it all of the sudden stopped working.

    Here’s the code on the site.

    <div id=”most-read” class=”tab-content”>
    <?php
    /******* Retrieve most popular posts using WordPress Popular Posts Plugin *******/
    if (function_exists(‘wpp_get_mostpopular’))
    {
    wpp_get_mostpopular(“post_type=post,photoessay&range=weekly&order_by=avg&limit=7&stats_author=1&post_html=’

    • <h4>{text_title}</h4><div class=\”post-meta\”>{author}</div>
    • ‘”);
      }
      ?>
      </div>

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

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hi @myntillae,

    Please go to Settings > WordPress Popular Posts, click on the Debug link (top center of your screen), and share the information shown there so I can have a look.

    Thread Starter myntillae

    (@myntillae)

    Thanks Hector! Here’s the debug information:

    Plugin Configuration
    Performance Nag: Remind me later

    Log Limit: No

    Log Views From: Everyone

    Data Caching: Yes, 1 minute

    Data Sampling: No

    External object cache: No

    WPP_CACHE_VIEWS: No

    System Info
    PHP version: 7.2.21

    PHP extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, session, standard, litespeed, bcmath, bz2, ctype, curl, dba, dom, enchant, mbstring, fileinfo, ftp, gd, gettext, iconv, imap, intl, json, ldap, exif, mysqlnd, odbc, PDO, pgsql, Phar, posix, pspell, shmop, SimpleXML, soap, sockets, sqlite3, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, xml, xmlwriter, xsl, zip, mysqli, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, wddx, xmlreader, xmlrpc, SourceGuardian, ionCube Loader, Zend OPcache

    Database version: 10.2.26-MariaDB

    InnoDB availability: YES

    WordPress version: 5.4.2

    Multisite: No

    Active plugins: AdSense In-feed Placement for WordPress 1.1.1, Advanced Ads 1.20.2, Advanced Custom Fields 5.9.1, Advanced Post Types Order 4.3.8.3, Ajax Load More 5.3.8, All In One SEO Pack 3.7.1, Blackhole for Bad Bots 2.9.1, Bulk Content Creator 1000.2.1, Catch IDs 2.1, Categories Images 3.0.1, Category Order and Taxonomy Terms Order 1.5.7.3, Co-Authors Plus 3.4.3, Custom Post Type UI 1.7.4, Download Monitor 4.4.4, Download Monitor – Gravity Forms Extension 4.0.1, Edit Author Slug 1.7.0, EWWW Image Optimizer 5.7.1, Gravity Forms 2.4.20, Gravity Forms iContact Add-On 1.5, Gravity Forms PayPal Standard Add-On 3.4, Gravity Forms User Registration Add-On 4.6, Heartbeat Control by WP Rocket 2.0, iThemes Sync 2.1.7, Meridian Mobile App API 1.1.1, Page Links To 3.3.4, Popup Maker 1.12.0, Popup Maker – Exit Intent Popups 1.4.0, Really Simple SSL 3.3.5, Redirection 4.8, Regenerate Thumbnails 3.1.3, Relevanssi 4.8.3, Remove XMLRPC Pingback Ping 1.3, Safe Redirect Manager 1.9.3, Scheduled Post Trigger 3.0, Search & Filter Pro 2.5.1, UpdraftPlus – Backup/Restore 2.16.29.1, WordPress Importer 0.7, WordPress Popular Posts 5.2.4, WP All Import 3.5.6, WP Downgrade | Specific Core Version 1.2.2, WP HTML Author Bio 1.2.0, WP Super Cache 1.7.1

    Theme: () by

    Thread Starter myntillae

    (@myntillae)

    I had the WP Super Cache plugin deactivated before we even realized that the feed wasn’t working, and activating it didn’t make any difference. Thought I would throw that out there in case it’s relevant information.

    Plugin Author Hector Cabrera

    (@hcabrera)

    I had the WP Super Cache plugin deactivated before we even realized that the feed wasn’t working, and activating it didn’t make any difference. Thought I would throw that out there in case it’s relevant information.

    Yep, that’s likely it @myntillae.

    Remember that WP Super Cache (WPSC from now on) will cache everything that’s on your site for a fixed amount of time. During this time your site’s pages will remain static and nothing will update until the next time WPSC’s cache gets regenerated again. The only bullet-proof way to prevent WPSC (or any caching plugin) from caching content that’s supposed to be dynamic (like your popular posts list) is by fetching said dynamic content from the server via AJAX.

    Since you’re using vanilla PHP to display your popular posts list, WPSC is caching whatever the output of the wpp_get_mostpopular() function is at the moment it generates the cached version of your website. In your case, it appears that WPSC cached your website right that moment where WPP didn’t have anything to show, hence the “Sorry, no data so far” was printed on your page and that message won’t go away until the next time WPSC regenerates its cache.

    So, possible solutions:

    1. Replace that PHP code snippet with an actual WordPress sidebar, place a WPP widget in it, go to Settings > WordPress Popular Posts > Tools, set Ajaxify Widget to Enabled, save changes, and then clear WPSC’s cache for these changes to be applied immediately.
    2. Write a JavaScript function that loads the output of the wpp_get_mostpopular() function into your Most Read tab via AJAX, then clear WPSC’s cache for this change to take effect.

    Sounds like a lot of work, right? Well, it is haha but that’s a trade-off you’ll have to accept if you want to continue using a caching plugin on your website with anything that outputs dynamic content, like WPP for example.

    If you have any questions at all don’t hesitate to ask.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Also relevant and you’ll want to read it in its entirety: Is WordPress Popular Posts compatible with caching plugins?

    Plugin Author Hector Cabrera

    (@hcabrera)

    It seems that my previous message got caught in the moderation queue. Do make sure to check back later as it contains some more detailed comments than the one above this one.

    Thread Starter myntillae

    (@myntillae)

    Oh, I was saying that the caching plugin wasn’t even active when we started noticing the problem. Even when I deactivated it again it still won’t display any data, so I’m not sure if it’s really that that’s causing the issue. We had the caching plugin active for a lot of years and it never conflicted with the WPP PHP code before, just all of the sudden it stopped working.

    The sidebar option does work, I just need to figure out how to get that to work in the PHP template. I’m not a PHP coding expert, but I’ll figure it out.

    Thread Starter myntillae

    (@myntillae)

    I ended up just creating a widget and then writing some PHP code to into the template where the feed is pulled from. Seems to be working okay.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘“Sorry. No data so far.” message’ is closed to new replies.