• Resolved rick9004

    (@rick9004)


    Have a CPT called “review” and works fine with all other plugins and theme functions except for Jetpack’s “like” function. I added “publicize” to that types “Custom Supports” per notes to do so.

    When I take the same actual post from a review CPT and add it as a normal Post type and display it, the “likes” work fine. It does not when it is a CPT.

    I have replaced my theme with another theme and with no modifications it fails the same way ( so it is not my theme ) Also it fails on my test system which is exactly the same as the live one except for HTTPS.

    Any suggestions?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Hard to say what may be going on here, without at least seeing the templates being used for your post types. We don’t do anything that’d prevent these features from showing up on content types registered with our plugin, so I have to believe the issue is at the template level.

    I’m looking at the Jetpack source code and to the best of my ability to see, it should be getting added to the the_content and the_excerpt filters. If your templates in question aren’t using those at all, explicitly or implicitly, then I could see them not showing up.

    Thread Starter rick9004

    (@rick9004)

    Thanks.. I switched to WordPress’s 2020 theme and the same issue occurs. I also looked at Jetpack’s code and I too see nothing that prevents it. I looked again at Jetpacks sharing features.

    Check this out https://jetpack.com/support/publicize/ Is the code below consistent with your plugin? see the area called: How to use Publicize with your Custom Post Types

    I can let you access my test site if you are interested. I’d need to remove the security, ( I use 2fa ) etc and get you a user/password.

    Alternatively I can try to add Jetpack’s code to your plugin on a temporary basis to test it.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    I managed to recreate the issue on a local copy…the issue is that I wasn’t able to add support fro the post type away from that “Custom supports” section either, so I’m not completely sure it’s a CPTUI issue as a whole.

    On a whim, see if define('IS_WPCOM', true ); added to your wp-config helps at all. It seems that the filtering is wrapped in that being true.

    $this->in_jetpack = ( defined( 'IS_WPCOM' ) && IS_WPCOM ) ? false : true;
    
    
    if ( $this->in_jetpack ) {
    	add_filter( 'the_content', array( &$this, 'post_likes' ), 30, 1 );
    	add_filter( 'the_excerpt', array( &$this, 'post_likes' ), 30, 1 );
    } 
    

    Worth a tinkering shot.

    Thread Starter rick9004

    (@rick9004)

    I’ll give it a try. BTW I tested another CPT plugin Pods – Custom Content Types and Fields and it works with the same text in a new post type “test”

    I tried the define(‘IS_WPCOM’, true ); and it totally killed the post display. It only displayed a few lines then stopped. When I turned on debug I saw that it threw this error: Fatal error: Uncaught Error: Call to undefined function get_blog_details() in /var/www/html/wp-content/plugins/jetpack/modules/likes.php

    My guess is that somewhere in your code the “publicize” is not getting to Jetpack. Is there any other way to turn that on?

    Thanks a lot for your help.. It is not many authors that actually respond like you.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    I’m really not sure what’s going on with this.

    I haven’t made any changes around this in a long time and the code matches what their documentation shows what it should be, for the at registration time version.

    For my testing, I was using their docs page’s Post types sections, and even tried with the add_post_type_support() function away from CPTUI and it didn’t work there either. So I don’t feel it’s exclusive to CPTUI

    Thread Starter rick9004

    (@rick9004)

    I asked Jetpack the same support question but they were not really interested in finding an answer (I wasn’t using one of their themes, etc.) I suspect that they are doing some things that are breaking at times under certain conditions. I’m not overly impressed with Jetpack.

    I may try writing a simple plugin/test harness to test the Jetpack functionality and see what happens.

    So… I’ll continue to try to find an answer. I didn’t spend almost 50 years in building software to give up. This is a hobby project for my daughter and I will try to convince here to drop Jetpack.

    If you do see any solution certainly post it please.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Will do.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘CPT with Jetpack “like” function’ is closed to new replies.