Site logo

Archived topic

Social Share Button only in Post

5 replies · Started by Lilia on January 9, 2020

Viewing posts 1–6 of 6

Dear Generatepress Team,
I have this Function but I need Social Share button only in my Post (I will exclude social share button from Sites and Blog list) - and will also show Social Share button in any language in Post !

function add_social_share() {

echo do_shortcode("[fl_builder_insert_layout slug='social_buttons']");

}

add_action('generate_after_content','add_social_share',10,3);

I will show Social Share button in these sites
https://www.eu-rights.com/reisewarnung-tuerkei-urlaub-sicher-reisen/ (here is online)
and here
https://www.eu-rights.com/tr/vize-danismanlik-sirketi-tuerkiye/ (but isn't online)

on these pages I want to disable it Social Share button

https://www.eu-rights.com
https://www.eu-rights.com/flugverspaetung/

Can you help me?

Many thanks for your Time
lili

hi David, many thx for your fast massage!

do you mean like this? I put this code in a Hook

add_action( 'social_share','social_share' );
function social_share() { ?>
echo do_shortcode("[fl_builder_insert_layout slug='social_buttons']");
<?php }

unfortunately this does not work

many thx for your help

You only need to echo the shortcode:

<?php echo do_shortcode("[fl_builder_insert_layout slug='social_buttons']"); ?>

Make sure to check execute PHP and Shortcodes.

Hi there,

Are you sure the Display Rules are correct? You can add some random text into the hook content to see if it shows up.

This archived topic is closed to new replies.