Tagged: Social toolbar
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.
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
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
Hi Femi,
That should not be happening, can you please create me an administrator account? post it here as a private reply.
Regards,
Josue
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
Works great. Many thanks.
You are welcome, glad to help :)
Regards,
Josue