-
AuthorPosts
-
October 14, 2014 at 6:49 am #335379
Hello, I am interested in showcasing the same social media sharing icons that appear at the bottom of post entries on the portfolio entries as well.
How can I do this?
Thanks!
October 14, 2014 at 9:20 am #335458Hey momon!
Thank you for using Enfold.
You can use this on functions.php:
add_action('ava_after_content', 'avia_add_social_toolbar', 10, 2); function avia_add_social_toolbar($id = "", $context = "") { if($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 = "") { $content .= avia_social_share_links(array(), false); $content .= '<div style="height:1px; margin-top:50px;" class="hr"></div>'; return $content; }
Cheers!
IsmaelOctober 14, 2014 at 4:32 pm #335637Thank you! it seems to work but it is showing up at the very bottom of the page which isn’t ideal on my current page setup. While I might be able to work around that it would be ideal if there was a way I could target the links to show up at a specific location? is there any way to do that?
Additionally I just noticed that the code is being applied everywhere (on all pages) including the homepage which isn’t ideal. Is there any way to limit it to portfolio items?
Thanks.
- This reply was modified 10 years, 1 month ago by momon.
October 18, 2014 at 4:33 am #337578Hey!
The share links can be included either before the post content or after, to make them appear only portfolio items change the code to this:
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('portfolio')){ $content .= avia_social_share_links(array(), false); $content .= '<div style="height:1px; margin-top:50px;" class="hr"></div>'; } return $content; }
Regards,
Josue- This reply was modified 10 years, 1 month ago by Josue.
October 18, 2014 at 6:12 am #337602Sorry sir, your code above seems to break my homepage completely. It strips out the entire content area of the homepage.
October 18, 2014 at 6:16 am #337609I edited the snippet, try it again.
Best regards,
JosueOctober 18, 2014 at 6:19 am #337611That seems to have worked. Thank you.
October 18, 2014 at 6:20 am #337614You are welcome, glad to help :)
Regards,
Josue -
AuthorPosts
- The topic ‘Social media sharing icons on portfolio entries’ is closed to new replies.