• Resolved kloni

    (@kloni)


    First – great work with jetpack plugin;)

    Now I have problem with Facebook like button under my posts. I have only the Facebook share button. I tried to change in settings to “official buttons” or even change WP templates but still this doesnt work and Like button doesnt appear.

    What am I doing wrong?:)

    https://www.ads-software.com/plugins/jetpack/

Viewing 15 replies - 1 through 15 (of 25 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    We did indeed change that button a few months back. We replaced the Facebook Like Button by the official Facebook Share button, to match the behaviour of the other sharing buttons and share your posts instead of just Liking them.

    If you’d like to use the Like button again, you can paste this code in your theme’s functions.php file, or in a functionality plugin:

    function jeherve_custom_fb_button( $fb_share_html, $share_url ) {
            $custom_fb_button = '<div class="fb-like" data-href="' . $share_url . '" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>';
            return $custom_fb_button;
    }
    add_filter( 'jetpack_sharing_facebook_official_button_output', 'jeherve_custom_fb_button', 2 );

    Feel free to change the different attributes to fit your needs!

    Thread Starter kloni

    (@kloni)

    Thanks for fast replay!
    That did the work for me and now it works “like” I wanted ??

    Keep up this fantastic work!

    I’m sorry but want to point out that when I put the code into functions.php, it shows errors as bellow…

    Warning: Missing argument 2 for jeherve_custom_fb_button(), called in /home/xxx/tadaaaa.com/public_html/wp-includes/plugin.php on line 235 and defined in /home/xxx/tadaaaa.com/public_html/wp-content/themes/tadaaaa-theme/functions.php on line 333

    it looked OK just mentioning facebook like and share button, but the error show up at the front of post every time…

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    Sorry, there is an element missing from the code snippet above. This will work:

    function jeherve_custom_fb_button( $fb_share_html, $share_url ) {
            $custom_fb_button = '<div class="fb-like" data-href="' . $share_url . '" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>';
            return $custom_fb_button;
    }
    add_filter( 'jetpack_sharing_facebook_official_button_output', 'jeherve_custom_fb_button', 10, 2 );

    It works!

    Thank you such a quick response.
    I really appreciate your help.

    ??

    Hi, can this code be placed anywhere within the functions file?

    Hi Jeremy,

    I am not sure why, but I still cannot get the ‘Like’ button to appear for my blog and it is super important for me. If you can have a look, I would greatly appreciate! Here is the URL to my post https://www.propertyresolved.com.au/the-journey-begins/

    And here is my functionality/functionality.php file:

    <?php
    
    /**
     * Makes it easy to create and edit your own functionality plugin
     * for pasting snippets instead of in the theme's functions.php
     *
     * To minimize confusion, throughout this file when I refer to
     * 'functionality plugin', I mean the functions.php file that is
     * created by this plugin in the WordPress plugins folder.
     * When I refer to 'this plugin', I'm talking about the plugin
     * whose code you're currently looking at.
     *
     * @version   1.2.0
     * @author    Shea Bunge <[email protected]>
     * @copyright Copyright (c) 2013-2016, Shea Bunge
     * @license   https://opensource.org/licenses/MIT
     */
    
    /*
    Plugin Name: Functionality
    Plugin URI: https://github.com/sheabunge/functionality
    Description: Makes it easy to create and edit your own functionality plugin for pasting snippets instead of in the theme's functions.php
    Author: Shea Bunge
    Author URI: https://bungeshea.com
    Version: 1.2.0
    License: MIT
    License URI: https://opensource.org/licenses/MIT
    Text Domain: functionality
    Domain Path: /languages
    */
    
    /**
     * Enable autoloading of plugin classes
     * @param $class_name
     */
    function functionality_autoload( $class_name ) {
    
    	/* Only autoload classes from this plugin */
    	if ( 'Functionality' !== substr( $class_name, 0, 13 ) ) {
    		return;
    	}
    
    	/* Remove namespace from class name */
    	$class_file = str_replace( 'Functionality_', '', $class_name );
    
    	/* Convert class name format to file name format */
    	$class_file = strtolower( $class_file );
    	$class_file = str_replace( '_', '-', $class_file );
    
    	/* Load the class */
    	require_once dirname( __FILE__ ) . "/php/class-{$class_file}.php";
    }
    
    spl_autoload_register( 'functionality_autoload' );
    
    /**
     * Create an instance of the class
     *
     * @since 1.0
     * @uses apply_filters() to allow changing of the filename without hacking
     * @return Functionality_Controller
     */
    function functionality() {
    	static $controller;
    
    	if ( ! isset( $controller ) ) {
    		$controller = new Functionality_Controller();
    	}
    
    	return $controller;
    }
    
    functionality()->run();
    
    function jeherve_custom_fb_button( $fb_share_html, $share_url ) {
            $custom_fb_button = '<div class="fb-like" data-href="' . $share_url . '" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>';
            return $custom_fb_button;
    }
    add_filter( 'jetpack_sharing_facebook_official_button_output', 'jeherve_custom_fb_button', 10, 2 );
    
    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    @dsbelousov You’ll need to switch to the “Official” button style under Settings > Sharing in your dashboard for the filter to work.

    @tr7p Sorry, for some reason I didn’t receive a notification about your question; you’ll need to place that code in your theme’s functions.php file, or in a functionality plugin.

    Thanks Jeremy, it worked. Any chance I can have the modern looking buttons to work with it? The “Official” buttons look very out-dated these days, at the same time the Facebook ‘Like’ button is absolutely a must for my blog (in fact this would be a must for any blog) as this is how you grow your audience. Please advise.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    If you want to keep the non-official buttons and add a Facebook Like button to the mix, you could use a plugin like this one:
    https://github.com/jeherve/like-share-facebook-jetpack

    It will add a new option to the Sharing Settings screen, so you’ll be able to add an official FB Like button in addition to your existing non-official buttons.

    In this case you don’t need the filter I mentioned earlier.

    Hi Jeremy,

    Thanks for your advise, yet I cannot find the plugin that you have mentioned ‘FB Like & Share button for Jetpack’. I have searched both on www.ads-software.com and via a dashboard. I have used directy plugin name as well as tags and was not able to find it. Can you perhaps provide me with exact keywords that I should be using for a search or link to the plugin?

    Thank you in advance

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    I linked to the plugin in my last post. Here is a link to the zip file you can download, and then upload to your site via Plugins > Add New > Upload:
    https://github.com/jeherve/like-share-facebook-jetpack/archive/master.zip

    Hi Jeremy, thanks a great deal, that has almost worked as I now have 2 FB share buttons, please see https://www.propertyresolved.com.au/the-journey-begins/

    How can I remove the old style (i.e. official) FB share button, as I would like to keep the new, round style icons for all my social sharing for consistency?

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    I’m not sure I understand. Which part would you like to remove on that screenshot?
    https://i.wpne.ws/iRzE

    Sorry for not being clear, – I would like to remove the old style ‘share’ button since I already have a new modern looking one. So if we look at your screenshot, it is number 3.

    Thank you

Viewing 15 replies - 1 through 15 (of 25 total)
  • The topic ‘Facebook Like Button dont appear’ is closed to new replies.