• Resolved paulwylie2

    (@paulwylie2)


    Hi Robin and thanks for this super lightweight plugin. I want to move where the buttons are output and copied and pasted the code below into my Genesis theme (Digital Pro) functions.php file but the icons don’t display.

    add_filter( ‘scriptlesssocialsharing_locations’, ‘prefix_change_sss_locations’ );
    function prefix_change_sss_locations( $locations ) {
    $locations[‘before’] = array(
    ‘hook’ => ‘genesis_before_entry’,
    ‘filter’ => false,
    ‘priority’ => 8,
    );
    $locations[‘after’] = array(
    ‘hook’ => ‘loop_end’,
    ‘filter’ => false,
    ‘priority’ => 8,
    );

    return $locations;
    }

    The “Use Genesis Framework hooks for button locations” is checked, Manual Placement for Posts and Pages is checked and Before and After Content unchecked. I have tried the code at top and bottom of functions.php and changed priority’s (in the code) from low to high values. I have also tried all this using the non Genesis WordPress 2017 theme but no joy. The buttons show if I check ‘Use Before and After content’, the default locations.

    I tried using this old code snippet you gave to someone a few years ago and it works in my functions.php file: –

    add_action( ‘genesis_before_footer’, ‘prefix_scriptlesssocialsharing_buttons_entry_content’, 5 );
    function prefix_scriptlesssocialsharing_buttons_entry_content() {
    echo wp_kses_post( scriptlesssocialsharing_do_buttons() );
    }

    Any suggestions? Do I need to use additional code or something?

    Thanks

    Paul

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

    (@littlerchicken)

    Your code is fine. However, what the locations filter is defining is the filter or action hook used with the plugin Before/After Content settings. So you need to uncheck the Manual Placement boxes, and check the Before/After Content boxes instead. The plugin will use your newly defined hooks for outputting the buttons, instead of its defaults.

    Manual Placement is for if you are using a function in a template or some code and need to make sure the styles load. So you don’t need the extra function; the locations filter will handle it, as long as you have a location selected.

    Thread Starter paulwylie2

    (@paulwylie2)

    That worked! I understand now Robin. It’s a filter and a filter modifies the output and I had disabled the output. Thanks for you speedy and clear response.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Unable to move the button location’ is closed to new replies.