Support » Plugin: Scriptless Social Sharing » Issue on genesis home/archive pages

  • Resolved mw360

    (@mw360)


    Hello, appreciate your work on this plugin…

    Using Genesis / Altitude Pro with Beaver Builder

    Note that the home page for that genesis child uses widget sections, and is set to ‘Latest Posts’.

    Plugin works just fine on posts, pages and most custom post types so long as I add custom function for genesis hooks (without that, gets duplicated in some places). So good on that.

    But, two issues:

    1) I can’t get it to work on the home page, nor on an archive page.

    I did add the recommended custom function to enable it for those, but still no go. Tried placing in sidebar or footer via widget/shortcode – It does technically show up, but the buttons have no style, and links are not properly formed.

    Also,

    2) Though I am able to see and select the woocommerce ‘products’ cpt in the settings page, nothing appears on those pages.

    But still using it for now in hopes it can be resolved, because I like the minimal impact and looks good on the working pages.

    Just really need to figure out at least the home page if possible.

    If you have any thoughts would appreciate.

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

    (@littlerchicken)

    A code change I made in the last version broke the ability to add the sharing buttons to archive pages with the proper link and title. I’ve pushed an update to the plugin repository on Github which should fix that. This version of the code has a few other changes from what’s available here on the WordPress repository but should be fine to run on your site. This change will be in the next plugin update.

    Once you’ve done that, adding this to your functions.php file should allow the buttons to load and run anywhere on your site:

    
    // Allow Scriptless Social Sharing buttons to load anywhere on the site.
    add_filter( 'scriptlesssocialsharing_can_do_buttons', '__return_true' );
    

    This is different from the example in the FAQ in that there are no conditionals in there at all so will load styles and attempt to add buttons sitewide. You may want to modify that to not run on certain pages, but the filter just needs to return true or false.

    Depending on how you have your Genesis theme settings set up, there are multiple ways you could add the sharing buttons to the archives and front (home) page. If you have the archives set to show full content, the buttons may already be there. If you use the content limit option instead, you might try this filter:

    
    add_filter( 'get_the_content_limit', 'prefix_scriptlesssocialsharing_buttons_entry_content', 25 );
    /**
     * When using content limit for front page featured posts widget and archives, add the sharing buttons.
     *
     * @param $content
     *
     * @return string
     */
    function prefix_scriptlesssocialsharing_buttons_entry_content( $content ) {
    	if ( is_singular() ) {
    		return $content;
    	}
    	if ( ! function_exists( 'scriptlesssocialsharing_do_buttons' ) ) {
    		return $content;
    	}
    
    	return $content . wp_kses_post( scriptlesssocialsharing_do_buttons() );
    }
    

    Depending on your site settings, you’ll have different hooks and filters available for the archive post output; definitely so for posts inside of widgets.

    As for the WooCommerce product pages, when I tested the sharing buttons using the default hooks (not the Genesis specific ones), they showed properly. If you switch to using Genesis hooks, they may not show due to WooCommerce using a pretty different setup for product output. The default hooks just use the_content filter, so should work pretty universally, unless that filter has been disabled somehow.

    Those are just some ideas for how to tackle the output–without a URL or knowing how you’ve customized the site, I can only suggest what may work in certain situations–you may need to modify based on your particular setup. Please practice safe coding before adding any of these to your site, back up your files, etc. Hope that helps!

    Thread Starter mw360

    (@mw360)

    Got it. Will check there. Appreciate that you are actively shaping this.

    Fortunately I live in a world of dev sites and volume snapshots so testing / rolling back never an issue LOL.

    I suppose the ability to allow to use Genesis hooks *except* for woocommerce might be a useful option, I don’t recall what that Genesis function looked like so I will go back and see if I can play with it.

    Thanks much

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Issue on genesis home/archive pages’ is closed to new replies.