Forum Replies Created

Viewing 15 replies - 1 through 15 (of 15 total)
  • Forum: Plugins
    In reply to: [AMP] Jetpack Functions
    Thread Starter Tyrosh

    (@iskmogul)

    just to clarify, I want the output to only display on AMP pages, but calling the removerp bit overrides anything else. I tried making an if/else statement with the two functions which relied on amp_is_request, but it wouldn’t work for some reason.

    I also tried adding the shortcode directly to the relevant amp file, but that didn’t work either.

    • This reply was modified 4 years, 3 months ago by Tyrosh.
    Thread Starter Tyrosh

    (@iskmogul)

    Think I figured it out, by adding a function to my child theme, it appears fixed:

    
    function mysite_customize_lazy_images( $blocked_classes ) {
        $blocked_classes[] = 'attachment-inhype-blog-thumb size-inhype-blog-thumb wp-post-image';
        return $blocked_classes;
    }
    
    add_filter( 'jetpack_lazy_images_blocked_classes', 'mysite_customize_lazy_images' );

    Can someone sanity check my usage of the element in blocked_classes? I think I got the right one.

    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.

    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.

    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.

    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 5 years, 5 months ago by Tyrosh.
    Thread Starter Tyrosh

    (@iskmogul)

    Correction: figured it out, seems to have been a setting I missed in login protection and another plugin conflict combined. Fixed. Make sure to check Login Protection as well if you run into this.

    Thread Starter Tyrosh

    (@iskmogul)

    I was able to get the dashboard to show up in incognito with that plugin disabled. However it still doesn’t work in normal browsing. Also when trying to reset site kit and reset permissions, I get “You don’t have permissions to authenticate with Site Kit.” after allowing permissions on Google.

    Edit: was able to get it working in incognito mode via disabling security and caching plugins. already had the site kit directory disabled in caching, will look into adding exceptions in the security plugin as well if I can.

    Are there any files that could exempted via .htaccess or other methods to allow the far future expiry plugin to no longer cause this issue?

    And it still appears to be broken in normal browsing. At least the core is reporting properly to Google though.

    • This reply was modified 5 years, 12 months ago by Tyrosh.
    • This reply was modified 5 years, 12 months ago by Tyrosh.
    Thread Starter Tyrosh

    (@iskmogul)

    The bar I’m seeing is the ###googlesitekit-notice-activated element. I didn’t notice any developer console errors other than the ones I’ve already reported.

    View post on imgur.com

    It seems like the plugin is activating, but not displaying output properly.

    Thread Starter Tyrosh

    (@iskmogul)

    No change, just get an infinite loading bar on the plugins page and the dashboard under site kit is the only thing showing up, all blank.

    And also, I disabled Cloudflare and Ezoic services when doing what you recommended, as they had caching as well. The setup worked fine prior to 1.10.0

    • This reply was modified 5 years, 12 months ago by Tyrosh.
    Thread Starter Tyrosh

    (@iskmogul)

    Alright, I submitted the form, including both the site health report and a console error, thanks.

    Thread Starter Tyrosh

    (@iskmogul)

    I’m dumb, found the solution minutes after making this. I hadn’t enabled OPCache in my PHP config.

    Thread Starter Tyrosh

    (@iskmogul)

    I looked into that, and it seems that it has not been updated in some time. I’m loathed to trust anything that’s not actively being developed. I appreciate trying to spread awareness, but I would caution anyone against using an out-of-date plugin.

    Tyrosh

    (@iskmogul)

    Had the same problem, appears to be an issue with Cloudflare and other CDNs improperly caching the admin area of WP.

    Set a Page Rule in your CDN like this:

    http://www.YOURDOMAIN.com/wp-admin/*

    Cache Level: Bypass
    Browser Cache TTL: 4 Hours
    Performance Disabled

    If those rulesets don’t work, try setting SSL to flexible, ff you’re using SSL. Also, make sure that the domain that’s set for the page rule is the same across your site. That means that all your traffic should redirect to one version of the domain (http://domain should goto http://www. and so on).

    • This reply was modified 8 years ago by Tyrosh.
    Thread Starter Tyrosh

    (@iskmogul)

    Did some testing and it seems to be an issue with the newest version. Reverting to 0.9.84.1 restored proper functionality.

Viewing 15 replies - 1 through 15 (of 15 total)