• Resolved Purple Hippo

    (@purplebabyhippo)


    I’m using Genesis and have some custom fields which I’ve hooked into genesis_entry_content. I would like the sharing buttons to appear after these custom fields rather than after the standard content and before the custom fields.

    I managed to add an additional set of sharing buttons in the correct place with this code:

    add_action( 'genesis_entry_content', 'prefix_scriptlesssocialsharing_buttons_entry_content', 25 );
    function prefix_scriptlesssocialsharing_buttons_entry_content() {
    
    		echo wp_kses_post( scriptlesssocialsharing_do_buttons() );
    	}

    But I’m not sure how to use your filters to remove the buttons to this location. Please can you help?

    https://wordpress.org/plugins/scriptless-social-sharing/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Robin Cornett

    (@littlerchicken)

    Just before your new add_action, you should be able to add this:

    remove_filter( 'the_content', 'scriptlesssocialsharing_print_buttons', 99 ); to remove the default sharing buttons. Hope that helps!

    Thread Starter Purple Hippo

    (@purplebabyhippo)

    Thanks Robin, that’s great : )

    Thread Starter Purple Hippo

    (@purplebabyhippo)

    Hi Robin,

    After adding this function, the pages on my site didn’t load correctly when your plugin was deactivated so I added a check for the plugin :

    remove_filter( 'the_content', 'scriptlesssocialsharing_print_buttons', 99 );
    add_action('genesis_entry_content', 'suf_scriptlesssocialsharing_buttons_entry_content', 25);
    function suf_scriptlesssocialsharing_buttons_entry_content() {
    
    		if ( ! function_exists( 'scriptlesssocialsharing_do_buttons' ) ) {
    			return;
    		}
    
    		echo wp_kses_post(scriptlesssocialsharing_do_buttons());
    }
    Plugin Author Robin Cornett

    (@littlerchicken)

    Yes, that’s definitely a better way to bulletproof it. I’ll update the readme to include that for the next release. Thanks–

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to move sharing buttons after custom fields’ is closed to new replies.