BuddyDev

Search

Trying to integrate WP ULike with MediaPress

  • Participant
    Level: Enlightened
    Posts: 23
    wingflap on #51162

    I tried to implement adding WP ULike buttons to my MediaPress Single Media Pages and Lightbox. According to https://buddydev.com/mediapress-like-unlike-button-for-photos-videos-etc-with-wp-ulike-plugin/, I added the following to my functions.php file in BuddyX Child theme (which I’m currently using on my site:

    /*
    Code to add WP-Like button to Mediapress Single Image Page and to Lightbox
    */
    function mpp_wpulike_show_button() {
    	
    	if( function_exists( 'wp_ulike_put_posts' ) ) {
    		echo wp_ulike_put_posts('');
    	}
    	
    //show it on single media page
    add_action( 'mpp_media_meta', 'mpp_wpulike_show_button' );
    //show it in lightbox
    add_action( 'mpp_lightbox_media_meta', 'mpp_wpulike_show_button' );
    
    }
    

    But nothing is showing on the page or in the Lightbox.

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #51164

    Hello,

    Sorry for the inconvenience. Please give it a try after switching to default WordPress default. Your theme might be causing the issue.

    Please let me know if it works or not.

    Regards
    Ravi

  • Participant
    Level: Enlightened
    Posts: 23
    wingflap on #51167

    I tried it in Twenty-Twenty-Four and it still doesn’t work.

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #51173

    Hello,

    Please try the following code:

    
    
    function mpp_wpulike_show_button() {
    
    	if( function_exists( 'wp_ulike_put_posts' ) ) {
    		echo wp_ulike_put_posts('');
    	}
    }
    
    //show it on single media page
    add_action( 'mpp_media_meta', 'mpp_wpulike_show_button' );
    //show it in lightbox
    add_action( 'mpp_lightbox_media_meta', 'mpp_wpulike_show_button' );
    
    

    Regards
    Ravi

  • Participant
    Level: Enlightened
    Posts: 23
    wingflap on #51174

    I added the code to functions.php in my theme folder and still don’t see the ‘Like’ button appearing. I’m wondering if it has anything to do with the settings in WP ULike. In the settings, there is a tab for Post Type. I can toggle the display of the Like buttons in Posts, BuddyPress Activity, and bbPress. I’m wondering if WP ULike is even aware of the Single Media page and the Lightbox?

    Is the code to display the Like button that you’ve provided going to even register within WP ULike? Is this even possible without having to mess with thw WP ULike plugin itself?

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #51178

    Hello,

    I have tried the following code:

    
    function mpp_wpulike_show_button() {
    
    	if( function_exists( 'wp_ulike' ) ) {
    		echo wp_ulike('put');
    	}
    }
    
    //show it on single media page
    add_action( 'mpp_media_meta', 'mpp_wpulike_show_button' );
    //show it in lightbox
    add_action( 'mpp_lightbox_media_meta', 'mpp_wpulike_show_button' );
    
    

    It is working for me.

    Regards
    Ravi

You must be logged in to reply to this topic.

This topic is: not resolved