-
AuthorPosts
-
June 4, 2015 at 1:21 am #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, 6 months ago by finchkelsey.
June 4, 2015 at 6:17 pm #454662Hi 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,
YigitJune 10, 2015 at 2:17 pm #457220before 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!
June 10, 2015 at 2:21 pm #457225Hi,
Can you post the link to one of your Posts please?
Regards,
JosueJune 10, 2015 at 2:27 pm #457234it 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/AXqKvF0AhBkn8June 10, 2015 at 3:05 pm #457265Hey!
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,
JosueJune 10, 2015 at 5:11 pm #457379hi,
thanks. however the bar title has gone away
https://yadi.sk/i/fF7hINFahBy3xJune 10, 2015 at 5:23 pm #457393Hi,
Can you please create us a WordPress administrator account? post it here as a private reply.
Regards,
JosueJune 10, 2015 at 5:58 pm #457432This reply has been marked as private.June 12, 2015 at 12:33 am #458116Check 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,
JosueJune 12, 2015 at 8:28 am #458242thank you very much. solved. should I delete the admin account I’ve created for you?
June 12, 2015 at 4:18 pm #458453 -
AuthorPosts
- The topic ‘Add social share bar to all pages, custom post types and templates’ is closed to new replies.