• Resolved Clayton Chase

    (@claytonchase)


    Hey guys,
    I am trying to display social share info in the post info. The plugin I’m using for social media is Social Warfare. They have a function to execute the post share: social_warfare();
    They also have a shortcode: [social_warfare]

    Would anyone be able to point me in the right direction as far get getting that to execute above the post title when displayed with the post shortcode?

    Thanks in advance!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Bill Erickson

    (@billerickson)

    You can use the output filter to modify what’s included with each post listed by this plugin. Here’s a tutorial with more information: https://www.billerickson.net/code/using-display-posts-shortcode-output-filter/

    As far as integrating Social Warfare, you’ll need to ask their support for the best method. Two issues you may run into using the social_warfare() function:

    1. It’s designed to display (echo) the share buttons rather than return it. You might have all the social share buttons appear (multiple times) at the top of the page you insert the shortcode in. To get around this, you may need to output buffer the function or find a social warfare function that returns rather than echoes the result.

    2. It may show the share buttons for the current page (ie: the one with the shortcode embedded in it) rather than the post shown in Display Posts Shortcode.

    Plugin Author Bill Erickson

    (@billerickson)

    By the way, I’m also one of the developers of Shared Counts, a free social sharing plugin similar to Social Warfare.

    While it’s not currently possible to include Shared Counts in display posts shortcode (issue #2 above), it should be possible with the next release. For more information on this improvement (and example code on how to add it to your site), see here: https://github.com/jaredatch/Shared-Counts/issues/45

    • This reply was modified 5 years, 11 months ago by Bill Erickson.
    • This reply was modified 5 years, 11 months ago by Bill Erickson.
    Thread Starter Clayton Chase

    (@claytonchase)

    Thanks for the in-depth reply! I’ll look into Shared Counts. We’ve been having issues with Social Warfare anyway.

    Thread Starter Clayton Chase

    (@claytonchase)

    Hey Bill,
    We are now using Shared Counts. You mentioned above that the functionality to include Shared Counts in display post shortcode was coming. How would I implement that?

    Plugin Author Bill Erickson

    (@billerickson)

    Here you go: https://www.billerickson.net/code/shared-counts-display-posts-shortcode/

    Once you add that to your theme’s functions.php file or a core functionality plugin, you can use: [display-posts include_shared_counts="true"] to display the buttons.

    You can change the style using the shared_counts_style attribute. Ex: [display-posts include_shared_counts="true" shared_counts_style="icon"]

    It’s set to display the share buttons at the very top of the listing item. You can change this position by moving the $share variable in line 22, where the output is re-assembled.

    Thread Starter Clayton Chase

    (@claytonchase)

    Amazing! Thank you

    Thread Starter Clayton Chase

    (@claytonchase)

    I think that the snippet on this page (https://www.billerickson.net/code/shared-counts-display-posts-shortcode/) is missing a paren on line 12. I was getting an unexpected return error and counted opening and closing () and added one and it’s working now.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Display Social Warfare Above Title’ is closed to new replies.