• Resolved Tyrosh

    (@iskmogul)


    After trying to apply styling to thumbnails to make them more in line with my theme, the related posts have completely disappeared from my site on all posts.

    The posts showed up when I first enabled them, but have since stopped showing up at all. I’ve checked my functions for the child theme, and it should be OK as I’m using the examples from the support page. I also copied the shortcode from that page too, so it should work.

    Here’s what I’ve tried so far:

    • Jetpack debug came back fine
    • Tried saving settings in Settings>Reading
    • Full sync run last night
    • Checked to make sure caches were cleared on-site, even disabled them while running sync
    • XML-RPC is publicly accessible
    • Cloudflare Rocket Loader is disabled

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

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor csonnek

    (@csonnek)

    Happiness Rocketeer ??

    I’ve checked my functions for the child theme, and it should be OK as I’m using the examples from the support page. I also copied the shortcode from that page too, so it should work.

    Can you share what modifications you’ve made? Once we have that information, we’ll be happy to take a closer look.

    Thread Starter Tyrosh

    (@iskmogul)

    Here’s the code in my functions.php relating

    function defer_parsing_of_js( $url ) {
        if ( is_user_logged_in() ) return $url; //don't break WP Admin
        if ( FALSE === strpos( $url, '.js' ) ) return $url;
        if ( strpos( $url, 'jquery.js' ) ) return $url;
        return str_replace( ' src', ' defer src', $url );
    }
    add_filter( 'script_loader_tag', 'defer_parsing_of_js', 10 );
    
    // remove related posts from default position
    function jetpackme_remove_rp() {
        if ( class_exists( 'Jetpack_RelatedPosts' ) ) {
            $jprp = Jetpack_RelatedPosts::init();
            $callback = array( $jprp, 'filter_add_target_to_dom' );
            remove_filter( 'the_content', $callback, 40 );
        }
    } add_filter( 'wp', 'jetpackme_remove_rp', 20 );
    
    //Change number of Jetpack RP posts
    function jetpackme_more_related_posts( $options ) {
        $options['size'] = 18;
        return $options;
    }
    add_filter( 'jetpack_relatedposts_filter_options', 'jetpackme_more_related_posts' );
    ?>

    I’m also calling the shortcode to insert the jetpack posts via this:

          <?php     if ( class_exists( 'Jetpack_RelatedPosts' ) ) {
        echo do_shortcode( '[jetpack-related-posts]' ); } ?>

    I had Jetpack with these settings before and the related posts showed up fine, only to randomly stop showing up a couple days later.

    • This reply was modified 4 years, 1 month ago by Tyrosh.
    Plugin Contributor Jen H. (a11n)

    (@jenhooks)

    Hey @iskmogul,

    We’re seeing a lot of errors in the browser console referencing magnetic.t.domdex.com. This may not be related to the Related Posts issue, but it’s worth tracking down to rule it out. Does that look familiar to you? Possibly an ad network?

    Thread Starter Tyrosh

    (@iskmogul)

    That’s an ad network cookie link it looks like to me. There’s a possibility that Ezoic, the ad network provider I use, could be involved. Although if that were true, it seems like the issues would have appeared right away. I had Ezoic long before I had Jetpack installed.

    I just ran a test and turned off the JS modification that Ezoic uses, no change as far as I can see even after clearing caches.

    Plugin Contributor Dan (a11n)

    (@drawmyface)

    Those js errors in the console may impact any other feature that uses javascript, including Jetpack’s related posts, so we’d suggest resolving those first. Let us know if the issue remains once the js errors are cleared up.

    Thread Starter Tyrosh

    (@iskmogul)

    I completely bypassed Ezoic (and it shouldn’t even run when I’ve logged in anyway) so that means no JS minification or caching from their end should be interfering. After clearing all caches on the server and turning on CF dev mode, the issue persists.

    Could this be a mixed content SSL issue or something else? I really can’t seem to get the related posts to display anymore when bypassing anything to do with JS being messed with, which if that was the issue, it seems like I could see them at some point. It’s just weird because it worked fine when I first installed the feature.

    Just for clarity to help nail down potential culprits, I’m using both Autoptimize (no JS minification) and WP Super-cache.

    I’ve already set the setting to not cache get parameters in WP Super-cache.

    Plugin Contributor Dan (a11n)

    (@drawmyface)

    Did you try deactivating Autoptimize and WP Super Cache to rule them out? It’s probably worth deactivating all other plugins just to completely rule out a plugin conflict.

    Jetpack’s Related Posts seems to be disabled on your site currently. Can you enable it again so we can see what’s happening?

    Thread Starter Tyrosh

    (@iskmogul)

    I disabled it because I have already tried disabling plugins and different settings galore, both failed to fix the issue. I’m fairly sure it’s a theme issue, as one of the plugins used by my theme appears to be conflicting with the way the related posts are rendered. But without a deep dive into the code, I have no way to verify. Far simpler just to use a theme-based solution of calling an in-theme posts block in place of Jetpack RP. I don’t get the actual targeted results, but it’s better than nothing.

    And contacting the theme author was no help, as they simply suggested that Jetpack was at fault and said it was essentially incompatible. So short of switching themes or a rewrite of possibly tons of code, I’m at my wit’s end with this.

    @iskmogul it sounds like you’ve figured this one out, even if the solution isn’t the most desirable. If you’ve confirmed that Related Posts does work with a different theme, then I’d say that you have the answer.

    I’d suggest testing other related posts solutions to see if those work. If you find that the theme is fully incompatible, you can push back a little more firmly with the author.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Related posts not showing up’ is closed to new replies.