Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #313655

    Hi,

    I use the template builder on my posts and I want to add the social toolbar.
    I tried using the code on https://kriesi.at/support/topic/share-icons-on-pages-and-portfolio-items/#post-260646

    It works but I don’t won’t the bar on my pages. I want it only on the posts.

    #314248

    Hey!

    Try with this code:

    add_action('ava_after_content', 'avia_add_social_toolbar', 10, 2);
    function avia_add_social_toolbar($id = "", $context = "")
    {
    	if($context == "post")
    		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 = "")
    {
    	$content .= avia_social_share_links(array(), false);
    	$content .= '<div style="height:1px; margin-top:50px;" class="hr"></div>';
    	return $content;
    }

    Best regards,
    Josue

    #315041

    Hi,

    Thanks for sending this.
    It works on all my pages & posts.
    However, I need it only on the posts; Is there any way I can make it not appear on my pages?

    Best regards,

    Femi

    #315296

    Hi Femi,

    That should not be happening, can you please create me an administrator account? post it here as a private reply.

    Regards,
    Josue

    #315702
    This reply has been marked as private.
    #316042

    Hey Femi,

    Try using this code instead:

    add_action('ava_after_content', 'avia_add_social_toolbar', 10, 2);
    function avia_add_social_toolbar($id = "", $context = "")
    {
    	if($context == "post")
    		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_singular('post')){
    	$content .= avia_social_share_links(array(), false);
    	$content .= '<div style="height:1px; margin-top:50px;" class="hr"></div>';
            }
    	return $content;
    }

    Best regards,
    Josue

    #316716

    Works great. Many thanks.

    #316774

    You are welcome, glad to help :)

    Regards,
    Josue

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Use the social toolbar with template builder posts’ is closed to new replies.