Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #454164

    Hello,
    How do I add the social share bar to all posts, pages, portfolio etc as well as to a custom template.

    I have added this which is working on pages so far..

    add_action(‘ava_after_content’, ‘avia_add_social_toolbar’, 10, 2);
    function avia_add_social_toolbar($id = “”, $context = “”)
    {
    if($context == “page” || $context == “single-portfolio”)
    avia_social_share_links();
    }

    2 – Also are we able to track the shares from this bar? Is there a dashboard menu option for this? How many shares, who shared etc..

    Thank you

    • This topic was modified 9 years, 5 months ago by finchkelsey.
    #454662

    Hi finchkelsey!

    You no longer need to use custom code to display share buttons. You can add Social Share Buttons element under Content elements of Advanced Layout Builder to any page you want :)

    Regards,
    Yigit

    #457220

    before theme update the below function.php code make social share bar appear after / below content before footer.

    add_action(‘ava_after_content’, ‘avia_add_social_toolbar’, 10, 2);

    function avia_add_social_toolbar($id = “”, $context = “”) {
    if ($context == “page” || $context == “single-portfolio”)
    avia_social_share_links();
    }

    add_filter(‘avf_template_builder_content’, ‘avia_add_social_toolbar_template_builder’, 10, 1);

    function avia_add_social_toolbar_template_builder($content = “”) {
    if (!is_front_page() && get_the_ID() != ‘1167’ ) {
    $content .= avia_social_share_links(array(), false);
    $content .= ‘<div style=”height:1px; margin-top:20px;” class=”hr”></div>’;
    }

    return $content;
    }

    however now, if I use this code, social share bar appears above (before)content.

    1. any way to make this code work?
    2. if not, should I add each page social share buttons manually?!?!? it sounds ridicilous… :(

    help needed!

    #457225

    Hi,

    Can you post the link to one of your Posts please?

    Regards,
    Josue

    #457234

    it was not like that before:
    http://www.g-e-z.com/egitim/acik-ve-net/

    before it is like that:(this is on my local dev environment. on the live I have updated the latest version of theme. after that this issue began. in my local there is no update, screenshot below):
    https://yadi.sk/i/AXqKvF0AhBkn8

    #457265

    Hey!

    Change your code to:

    
    add_filter("avf_template_builder_content", "avia_add_social_toolbar_template_builder", 10, 1);
    
    function avia_add_social_toolbar_template_builder($content = '') {
    if (!is_front_page() && get_the_ID() != "1167" ) {
    $content .= avia_social_share_links(array(), '','',false);
    $content .= "<div style='height:1px; margin-top:20px;' class='hr'></div>";
    }
    
    return $content;
    }

    Best regards,
    Josue

    #457379

    hi,

    thanks. however the bar title has gone away
    https://yadi.sk/i/fF7hINFahBy3x

    http://www.g-e-z.com/egitim/etkin-iletisim/

    #457393

    Hi,

    Can you please create us a WordPress administrator account? post it here as a private reply.

    Regards,
    Josue

    #457432
    This reply has been marked as private.
    #458116

    Check it, final code:

    function avia_add_social_toolbar_template_builder($content = '') {
    if (!is_front_page() && get_the_ID() != "1167" ) {
    $content .= avia_social_share_links(array(), '','Share this',false);
    $content .= "<div style='height:1px; margin-top:20px;' class='hr'></div>";
    }
    
    return $content;
    }

    Regards,
    Josue

    #458242

    thank you very much. solved. should I delete the admin account I’ve created for you?

    #458453

    Merhabalar!

    Sure, if you need any help in future that requires us to login to your website, then you can create another one :) I am marking this thread as resolved, glad Josue could help!

    Regards,
    Yigit

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Add social share bar to all pages, custom post types and templates’ is closed to new replies.