-
AuthorPosts
-
April 24, 2019 at 8:04 pm #1094141
I’m using the following code to change the title field of social buttons. The problem is that the title is printed with heading <h5>. Even if you leave it empty, heading <h5> is printed equally (empty). How can I do to delete heading <h5>? Thank you
I would like to share the social buttons by changing the title written.
add_filter (‘avia_social_share_title’, ‘new_share_title’);
function new_share_title () {
$ output = ‘Share this post on:’;
return $ output;
}April 25, 2019 at 4:45 am #1094284Hey dnetwork,
Try adding this code to the end of your functions.php file in Appearance > Editor instead:function custom_script(){ ?> <script> (function($){ $(document).ready(function(){ var el = document.querySelector('.av-share-link-description'); el.outerHTML = '<span class="avia-caption-title ">' + 'Share this post on:' + '</span>'; }); })(jQuery); </script> <?php } add_action('wp_footer', 'custom_script');
Then clear your browser cache and any cache plugin, and check.
You will probably want some css for the new title, please let us know if you would like some help with that.Best regards,
MikeApril 25, 2019 at 10:42 am #1094343Hi Mike, thanks for your cooperation. I entered the code, but the header is again present (<h5 class = ‘av-share-link-description av-no-toc’> Share this article </ h5>). Look at a random page https://www.irlandaonline.com/cosa-vedere/nord/contea-di-derry/derry/ Other ideas? Thanks again.
April 25, 2019 at 1:15 pm #1094394Hi,
Thanks for the feedback, but when I check your link the “h5” has been replaced with “span” as the function does.
Please see the screenshot in Private Content area.
Please clear your browser cache and check.Best regards,
MikeApril 25, 2019 at 1:36 pm #1094399Thanks Mike,
I emptied the cache but I always find the header (<div class = ‘av-share-box’> <h5 class = ‘av-share-link-description av-no-toc’> Share this article </h5>) . Try to consult the link that I share in private. Thank youApril 26, 2019 at 12:17 am #1094560Hi,
Oh, I see, I believe this bot is getting the results before the script runs, if you look at the page on load the h5 is not there.
As per my screenshot above.
I can’t find another solution that will change the text before the DOM, so your seo test will show it, unless you change the \enfold\includes\helper-social-media.php file directly.
Try looking for this on about line 221-223:$this->html .= "<h5 class='av-share-link-description av-no-toc'>"; $this->html .= apply_filters('avia_social_share_title', $this->title , $this->args); $this->html .= "</h5>";
You will want to change “h5” to another “h” style or to a “span”
If you wish to add this modification to your child theme you will need to copy the whole helper-social-media.php file into your child theme functions.php
I have just tested and it seens to work fine.Best regards,
MikeApril 26, 2019 at 9:31 am #1094661Great Mike!
April 26, 2019 at 1:20 pm #1094723Hi,
Glad to help, I assume we can close this now, but I like to ask first. Shall we close this then?Best regards,
MikeApril 26, 2019 at 2:05 pm #1094737Yes!
April 27, 2019 at 1:40 am #1094843Hi,
Glad we were able to help, we will close this now. Thank you for using Enfold.For your information, you can take a look at Enfold documentation here
For any other questions or issues, feel free to start new threads in the Enfold forum and we will gladly try to help you :)Best regards,
Mike -
AuthorPosts
- The topic ‘Remove heading from social share title’ is closed to new replies.