Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #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;
    }

    #1094284

    Hey 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,
    Mike

    #1094343

    Hi 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.

    #1094394

    Hi,
    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,
    Mike

    #1094399

    Thanks 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 you

    #1094560

    Hi,
    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,
    Mike

    #1094661

    Great Mike!

    #1094723

    Hi,
    Glad to help, I assume we can close this now, but I like to ask first. Shall we close this then?

    Best regards,
    Mike

    #1094737

    Yes!

    #1094843

    Hi,
    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

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Remove heading from social share title’ is closed to new replies.