WordPress.org

Forums

Jetpack by WordPress.com
[resolved] Class Jetpack_Likes not found (9 posts)

  1. BrunoAmaral
    Member
    Posted 1 year ago #

    I am trying to position the wordpress like button on a different part of http://www.brunoamaral.eu and when I follow the instructions in http://jetpack.me/2013/06/10/moving-sharing-icons/ the script shows an error message of "Class Jetpack_Likes not found".

    As far as I could tell, jetpack is connected to wordpress.com and everything is working as it should. The like button even appears where he is supposed to, in the share-dropdown button and is working.

    I am at a loss here, is there anything else I can to do troubleshoot the issue?

    http://wordpress.org/plugins/jetpack/

  2. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 1 year ago #

    Could you let me know the exact changes you've made to your theme?

    Thanks!

  3. BrunoAmaral
    Member
    Posted 1 year ago #

    @Jeremy, even better, the source code is hosted in github :)

    https://github.com/brunoamaral/adp

  4. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 1 year ago #

    I just sent you a pull request. Could you have a look at it and let me know if it helps?

  5. BrunoAmaral
    Member
    Posted 1 year ago #

    This is quite strange. I had tried that exact line of code and it wasn't working.

    Right now it all seems to be in order, thank you ! :)

  6. BrunoAmaral
    Member
    Posted 1 year ago #

    @Jeremy, I figured out what the issue was.

    At my development server Jetpack was not linked to wordpress.com, as a result the class for Jetpack Likes wasn't loaded.

    I added a sanity check to your code to make sure this doesn't break the theme.

    if (class_exists('Jetpack_Likes') {
    }

    Thank you again for your help. :)

  7. BrunoAmaral
    Member
    Posted 1 year ago #

    After upgrading to Jetpack 2.5 this solution no longer works. At least not in this particular case.

    I am trying to figure out what exactly changed between 2.4.2. and 2.5 since the class names and hooks used seem to have stayed the same.

  8. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 1 year ago #

    Thanks for the report! I'll look into it and let you know as soon as I have a solution.

  9. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 1 year ago #

    We found the issue, and we updated the blog post accordingly: you will now need to use the following code to remove sharing buttons and Likes from the bottom of your posts:

    function jptweak_remove_share() {
        remove_filter( 'the_content', 'sharing_display',19 );
        remove_filter( 'the_excerpt', 'sharing_display',19 );
        remove_filter( 'the_content', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 );
    }
    
    add_action( 'loop_start', 'jptweak_remove_share' );

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Jetpack by WordPress.com
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags