Viewing 30 posts - 1 through 30 (of 30 total)
  • Author
    Posts
  • #1438368

    Is it possible to make the Toggle Titles in the accordion feature H3’s without breaking the functionality? I don’t need to change the formatting or size of the text, but need them to be H3’s for SEO purposes. Thanks.

    #1438384

    put this to your child-theme functions.php:

    function my_avf_customize_heading_settings( array $args, $context, array $extra_args = array() ){
      if( $context == 'avia_sc_toggle' ){
        $args['heading'] = 'h3';              
      }
      return $args;
    }
    add_filter( 'avf_customize_heading_settings', 'my_avf_customize_heading_settings', 10, 3 );
    #1438401

    Hi,

    Thank you for the inquiry.

    Aside from using the filter above, you can also adjust the Advanced > Toggle Titles > Toggle Title Tag settings.

    Best regards,
    Ismael2

    #1438414

    By the way Ismael, would it be possible to change the filter conditionally like in the Alb Element itself?
    Because my method above changes all toggle titles at once, but has the disadvantage that if an individual tag has been set, this is also subject to the filter.

    The alb itself got this ternary operator
    $default_heading = ! empty( $meta['heading_tag'] ) ? $meta['heading_tag'] : 'p';

    so is it possible to use the filter – but leave it untouched if meta heading_tag is set?

    #1438424

    Hi,


    @Guenni007
    : You could check the value of the heading within the $args variable. If it’s set to the default value (p), proceed; otherwise, use the selected heading_tag.

    Best regards,
    Ismael

    #1438442

    Thanks for the quick replies and info Ismael and Guenni007.

    Changing the option under the Advanced > Toggle Titles > Toggle Title Tag settings worked perfectly.

    #1438478

    Hi NicomIT,

    Thanks for the update. Please let us know if you should need any further help on the topic, or if we can close it.

    Best regards,
    Rikard

    #1438519

    @Ismael : Please show a working snippet. – I have tried many things with no result.

    #1438524

    Hi,


    @Guenni007
    : Please try this filter:

    function my_avf_customize_heading_settings(array $args, $context, array $extra_args = array())
    {
        if ($context == 'avia_sc_toggle' && $args['heading'] === 'p') {
            $args['heading'] = 'h3';
        }
    
        return $args;
    }
    add_filter('avf_customize_heading_settings', 'my_avf_customize_heading_settings', 10, 3);

    We just added this condition:

    && $args['heading'] === 'p'
    

    Best regards,
    Ismael

    #1438544

    yes thanks that works – do we have to use strict equality here?
    A small drawback: if you want to set the p-tag in the Alb, this is no longer possible.

    #1438557

    Hi @Guenni007,

    strict equality

    No, not needed.

    p-tag

    You need to check $extra_args. In the ALB element you find:

    
    $extra_args = array( $this, $atts, $content, 'title' );
    

    means you can use:

    
    $atts = extra_args [1];
    

    and you have access to all shortcode attributes – if you set a custom id or class you can check it here.

    Best regards,
    Günter

    • This reply was modified 8 months, 3 weeks ago by Günter.
    #1438560

    Please tell me how –
    i know that i can have a child-theme toggles.php – but it might be possible to only replace the heading_tag by that filter if choice is on “Theme default”

    #1438883

    Hi @Guenni007,

    Sorry for the late reply.

    
    
    
    function my_avf_customize_heading_settings(array $args, $context, array $extra_args = array())
    {
    	if( $context != 'avia_sc_toggle' )
    	{
    		return $args;
    	}
    
    	$atts = $extra_args [1];
    
    	if( '' == $atts['heading_tag'] )
    	{
    		$args['heading'] = 'h3';
    	}
    
        return $args;
    }
    
    add_filter('avf_customize_heading_settings', 'my_avf_customize_heading_settings', 10, 3);
    
    
    
    
    $atts['heading_tag']
    

    is the value of the selectbox “Toggle Title Tag (Theme Default is <p>)”

    Best regards,
    Günter

    #1438974

    I would never have thought of it myself. Thank you so much.

    But I don’t quite understand the logic. Because I want to change this just for the toggles only (so why the not equal) – wouldn’t a logical combination of both conditions be the method of choice?

    function my_avf_customize_heading_settings(array $args, $context, array $extra_args = array()){
    	$atts = $extra_args [1];
    	if( $context == 'avia_sc_toggle' && $atts['heading_tag'] == ''){
    		$args['heading'] = 'h3';
    	}
        return $args;
    }
    add_filter('avf_customize_heading_settings', 'my_avf_customize_heading_settings', 10, 3);
    #1438976

    Hi @Guenni007,

    In my solution I leave the filter right away if not ‘avia_sc_toggle’ avoiding copying of $extra_args [1] if not needed (arrays are copied and not only a reference to it).

    Your solution is also OK. Depending on what you want to do or what other logic you need in this filter (e.g. for other elements) there are always different approaches.

    Best regards,
    Günter

    #1438979

    ok – now I understand the negation – if it is not the toggle, the filter is left. I’ve learnt something new.

    _______

    for : avia_sc_contact , avia_sc_icon_box , avia_sc_iconlist
    it will work too.
    for the last one i do not know how to differ between small list and big list if needed.

    but for avia_sc_content_slider and avia_sc_partner_logo – it does not work that way

    PS: ok i see – for partner logo it is : avia_partner_logo – and for content slider it is: avia_content_slider
    (wrong if ( ! class_exists statement )

    now with contentslider i got those extra_args : slider_title and slider_entry
    how to combine it in this case?

    i know how to include that extra_args on f.e. timeline:
    if( $context == 'avia_sc_timeline' && is_array( $extra_args ) && in_array( 'title', $extra_args ) )

    but the combination is hard for me to see how to obtain that.

    #1438983

    Hi,

    avia_sc_iconlist

    correct – currently not possible. I will add the attributes of “container” element to $extra_args. Will let you know here.

    avia_sc_content_slider

    it is avia_content_slider

    Best regards,
    Günter

    #1438987

    Hi @Guenni007,

    https://github.com/KriesiMedia/enfold-library/blob/master/temp_fixes/Enfold_5_6_11/avia-shortcodes/iconlist/iconlist.php

    see line 1117 ff

    In filter use:

    $element_atts = $extra_args[4];

    and for styling:

    
    $element_atts['iconlist_styling']    //  '' | 'av-iconlist-small'
    

    Best regards,
    Günter

    #1438988

    PS: ok i see – for partner logo it is : avia_partner_logo – and for content slider it is: avia_content_slider

    ok – and i edited that post for content_slider – how to differ with slider_title and slider_entry ?
    thats not possible for now?

    #1438992

    Hi,

    $extra_args[1] = ‘slider_title’ | ‘slider_entry’

    see lines 1096, 1182 ff

    Best regards,
    Günter

    #1439023

    Hey there. Quick update on what I implemented.

    Things worked good. Just one issue – when viewed on a mobile device, the accordion titles don’t always open when clicked on. Sometimes they work fine, but then other times nothing happens when you click on them. Here are two pages where the accordion has been set-up and we are seeing this issue:

    https://www.nicomit.com/
    https://www.nicomit.com/services/managed-technical-support-services/

    Any help would be appreciated. Thanks!

    #1439248

    Hi,

    Looks like the issue also happens on desktop view. It might be due the following script error which is generated from the compressed (autoptimize_single) script.

    Uncaught TypeError: $.avia_utilities.supports is not a function
        at avia_hover_effect (autoptimize_single_aec3c90c3ca8780bf5fccbd8621958ec.js:105:42)
        at $.avia_utilities.avia_ajax_call (autoptimize_single_aec3c90c3ca8780bf5fccbd8621958ec.js:33:29)
        at HTMLDocument.<anonymous> (autoptimize_single_aec3c90c3ca8780bf5fccbd8621958ec.js:11:44)
        at e (jquery.min.js:2:27028)
        at t (jquery.min.js:2:27330)
    

    Please try to deactivate the Autoptimize plugin temporarily and let us know of the result.

    Best regards,
    Ismael

    #1439286

    Hi Ismael,
    Thanks for having a look at that. I think it was related to the Autoptimize plugin. I disabled that and the accordions look to be working. Can you check on your end?

    They were working in Chrome on desktop, but when I checked in Edge they were having the same issue that we were seeing on mobile. They are working in Edge now that the plugin has been disabled.

    Ryan

    #1439321

    One question about sliders – the context is on all sliders : avia_slideshow
    and filter is placed inside class-avia-slideshow.php – the $default_heading is build differently to the other alb elements.

    how to only replace the default setting (h2) only e.g. for easy-slider (avia_sc_slider)?

    #1439458

    Hi,


    @NicomIT
    : Yes, the toggles are now working as expected. Please feel free to open another thread if you have more questions.


    @Guenni007
    : Looks like the filter avf_customize_heading_settings is not available for the avia_sc_slider class. We’ll forward this to our channel.

    Best regards,
    Ismael

    #1439470

    yes it is all inside the helper file: class-avia-slideshow
    but even if i use that class: avia_slideshow the extra_args [1] will not work here

    btw: I think it would generally make more sense if the filter could only ever replace the “default setting”. After all, if you have manually set a different heading tag, you usually want to keep it. Or do you not?

    #1439503

    Hi @Guenni007,

    https://github.com/KriesiMedia/enfold-library/blob/master/temp_fixes/Enfold_5_7/avia-shortcode-helpers/class-avia-slideshow.php

    I modified the filter parameters (see line 973ff).

    You can use this filter now like:

    
    
    function my_avf_customize_heading_settings( array $args, $context, array $extra_args = array() )
    {
    	if( 'avia_slideshow' == $context  )
    	{
    		//	get class of slideshow
    		$slider_class = get_class( $extra_args[2] );
    
    		if( in_array( $slider_class, [ 'avia_sc_slider', 'avia_sc_slider_fullscreen', 'avia_sc_slider_full' ] ) )
    		{
    			$index = $extra_args [1];
    
    			//	current slide in loop
    			$slide = $extra_args [3];
    
    			//	get shortcode attributes of current slide
    			$attr = $slide['attr'];
    
    			//	only change for first slide and when default
    			if( '' == $attr['heading_tag'] && 0 == $index )
    			{
    				$args['heading'] = 'h3';
    			}
    		}
    	}
    
    	return $args;
    }
    
    add_filter( 'avf_customize_heading_settings', 'my_avf_customize_heading_settings', 10, 3 );
    
    

    … only ever replace the “default setting” ….

    It gives more flexibility e.g. if there is dynamic created content on the page (e.g. like in upcoming 6.0 with ACF fields and/or in custom layouts )

    Best regards,
    Günter

    #1439510

    Many thanks !!!

    So if I want to disregard the slide number – and just want to change all default headings in the Easy-Slider to h1 – then:
    i do not need the index in this case

    function my_avf_customize_heading_settings( array $args, $context, array $extra_args = array()){
    	if( 'avia_slideshow' == $context ){
    		//	get class of slideshow
    		$slider_class = get_class( $extra_args[2] );
    		if( in_array( $slider_class, [ 'avia_sc_slider' ])){
    			//	current slide in loop
    			$slide = $extra_args [3];
    			//	get shortcode attributes of current slide
    			$attr = $slide['attr'];
    			//	only change for first slide and when default
    			if( '' == $attr['heading_tag']  ){
    				$args['heading'] = 'h1';
    			}
    		}
    	}
    	return $args;
    }
    add_filter( 'avf_customize_heading_settings', 'my_avf_customize_heading_settings', 10, 3 );
    #1439578

    Hi @Guenni007,

    Correct. Your script above should do it.

    Best regards,
    Günter

    #1439612

    From my point of view the topic can be closed now – thanks again.

Viewing 30 posts - 1 through 30 (of 30 total)
  • The topic ‘Change Toggle Title in Accordion Feature to H3’ is closed to new replies.