Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1266928

    Hi, in need to changes toggle headers from p to h3. Please, I need the code to insert in functions.php in the child theme.
    Thanks.

    #1266941

    i realy think that the best and propper way would be to have a child-theme toggles.php file
    you find the original file in your enfold folder: /config-templatebuilder/avia-shortcodes/toggles/

    on line 917 ( Enfold newest Version) there is :

    $output .= '        <p data-fake-id="#' . $toggle_atts['custom_id'] …
    

    and the closing tag is on line 918

    $output .= '        <span class="vert_icon"></span><span class="hor_icon"></span></span></p>';
    

    instead of those two p insert your h3
    see here the edited file: https://pastebin.com/fREzmbUb
    or download it from my pastebin : Link

    put that edited ALB Element to your child-theme/shortcodes folder
    this folder is not per se in your child-themes folder – create it then

    and put this ( if it is not allready done) to your child-theme functions.php :
    you find this snippet on documentation : https://kriesi.at/documentation/enfold/intro-to-layout-builder/#customization

    function avia_include_shortcode_template($paths){
      $template_url = get_stylesheet_directory();
          array_unshift($paths, $template_url.'/shortcodes/');
      return $paths;
    }
    add_filter('avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1);
    • This reply was modified 3 years, 11 months ago by Guenni007.
    #1266942

    There is probably also a jQuery solution without the need to deposit a child theme version of toggles.php file .
    However, some of the contributors here are of the opinion that bots such as the Google Bot would probably read over these jQuery replacements and still SEO wise lead the as p-tag.

    you can test this first in your child-theme functions.php:

    function replace_tags_with_tags(){
    ?>
    <script>
      (function($) {       
          function replaceElementTag(targetSelector, newTagString) {
            $(targetSelector).each(function(){
              var newElem = $(newTagString, {html: $(this).html()});
              $.each(this.attributes, function() {
                newElem.attr(this.name, this.value);
              });
              $(this).replaceWith(newElem);
            });
          }
          replaceElementTag('.togglecontainer p.toggler', '<h3></h3>');
      }(jQuery)); 
    </script>
    <?php
    }
    add_action('wp_footer', 'replace_tags_with_tags');
    #1267145

    Hi,

    Thanks for helping out @guenni007 :-)

    Best regards,
    Rikard

    #1267945

    i guess you had to help her – she ( or he – could be both with that nick) – only 2 postings on her history. Maybe that is hard stuff for a beginner

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.