[Support request] Social Share Button only in Post

Home Forums Support [Support request] Social Share Button only in Post

Home Forums Support Social Share Button only in Post

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1126916
    Lilia

    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

    #1126938
    David
    Staff
    Customer Support

    Hi there,

    you can use the Hook Element:

    https://docs.generatepress.com/article/hooks-element-overview/

    To output your shortcode e.g.

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

    #1127000
    Lilia

    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

    #1127004
    David
    Staff
    Customer Support

    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.

    #1127033
    Lilia

    🙂 Dear David, thank you!

    I create a Hook for two language !

    for German works !
    https://www.eu-rights.com/flughafen-sabiha-goekcen-flug-storniert/

    but second hook dont work!

    https://www.eu-rights.com/tr/ucus-roetarlarinda-yolcu-sorumluluklari/

    do you have any idea?

    thx for your Time

    #1127295
    Tom
    Lead Developer
    Lead Developer

    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.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.