Hello,
My accordion is not working on this page: https://lecoqdigital.com/creation-de-site-internet/ (pwd: LCD)
Could you please help me to solve the problem?
Thanks,
Antoine
Hello,
My accordion is not working on this page: https://lecoqdigital.com/creation-de-site-internet/ (pwd: LCD)
Could you please help me to solve the problem?
Thanks,
Antoine
Hi Antoine,
Thanks for writing in! Could you please try disabling your 3rd party plugins and re-test this issue again. If the issue is resolved, you can then activate your plugins one by one to see which plugin creates this conflict.
Let us know how it goes.
Thanks!
I deactivated all the plugins and the problem remains. It must be something else… Could you please have a look?
Thanks,
Antoine
Hi again,
Thank you for providing the credentials. I did some testing and it seems like there is a customization in your Child Theme which is preventing the accordions to work. as soon as i deactivated your child theme and activated your parent theme, accordions started to work fine.
For now I’ve reactivated your child theme since it’s your live site. Please review and remove the conflicting customization from your child theme to resolve the issue.
Cheers!
Thank you. Some code in the functions.php of the child theme was causing the problem. I used the following code, in order to make the title of the accordion H2 (code I found on the support forum a while ago). I guess the code is not valid anymore. Could you please help to to update it to make it work?
// Make Accordion Heading H2
// =============================================================================
function x_shortcode_accordion_item_v2( $atts, $content = null ) {
extract( shortcode_atts( array(
'id' => '',
'class' => '',
'style' => '',
'parent_id' => '',
'title' => '',
'open' => ''
), $atts, 'x_accordion_item' ) );
$id = ( $id != '' ) ? 'id="' . esc_attr( $id ) . '"' : '';
$class = ( $class != '' ) ? 'x-accordion-group ' . esc_attr( $class ) : 'x-accordion-group';
$style = ( $style != '' ) ? 'style="' . $style . '"' : '';
$parent_id = ( $parent_id != '' ) ? 'data-cs-collapse-parent="#' . $parent_id . '"' : '';
$title = ( $title != '' ) ? $title : 'Make Sure to Set a Title';
$collapse = ( $open == 'true' ) ? 'collapse in' : 'collapse';
$collapsed = ( $open != 'true' ) ? ' collapsed' : '';
$output = "<div {$id} class=\"{$class}\" {$style} data-cs-collapse-group>"
. '<div class="x-accordion-heading">'
. "<a class=\"x-accordion-toggle{$collapsed}\" data-cs-collapse-toggle {$parent_id} ><h2 class=\"x-accordion-head\">{$title}</h2></a>"
. '</div>'
. "<div class=\"x-accordion-body {$collapse}\" data-cs-collapse-content>"
. '<div class="x-accordion-inner">'
. do_shortcode( $content )
. '</div>'
. '</div>'
. '</div>';
return $output;
}
add_action('wp_head', 'change_shortcode_accordion');
function change_shortcode_accordion() {
remove_shortcode( 'x_accordion_item' );
add_shortcode( 'x_accordion_item', 'x_shortcode_accordion_item_v2' );
}
Thanks,
Hey @Camilletra,
I’m sorry but we do not have support for modified functions. The codes we provide here in the forum serve only as a guide and they are not official parts of the theme. It is the users responsibility to fix and maintain the custom code. What I could do now is point you to the right direction.
The Accordion shortcode is different now that is why the custom code doesn’t work. You can see the updated function in accordion.php file located in pro\cornerstone\includes\shortcodes. If you’re using X or Cornerstone separately, go to the plugins folder and go to cornerstone\includes\shortcodes.
Look for the x_shortcode_accordion_item
function and inside that function, change the div
in the <div class="x-accordion-heading">
line to h2
, Don’t forget to change the closing </div>
to </h2>
in line 78. Once done, copy the contents of the function to your custom function x_shortcode_accordion_item_v2
Now that you know how the Classic Accordion shortcode / element is overridden, once the code breaks in the future, you will need to refer to the updated function again and change parts of the code.
If it still does not work, you will need to hire a third party developer.
I’ll forward this as feature request though in order for our development team to be aware of user interests.
Thank you for understanding.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.