• Resolved Guga Alves

    (@gugaalves)


    On that article at https://rankmath.com/kb/turn-faq-block-into-accordion/you show how to create an accordion when using the FAQ block, some questions about it:

    1 – There’s a way to do it without using JS? I can see some blog posts around the web showing how to do with CSS only…

    2 – From an SEO perspective, adding the add_action on wp_footer will make that script be available on every page and that’s not really a good thing. There’s a way to add it only on pages using the FAQ block?

Viewing 1 replies (of 1 total)
  • Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @gugaalves,

    Thank you for contacting the support.

    1. The JS is necessary to add an event listener. It is used to make the accordions expand and collapse when the user clicks on them.

    2. If you don’t want to run the filter everywhere, you can add a condition to only apply the filter to specific post IDs. Here is an example:

    if ($post->ID == 216) {
    add_action( 'wp_footer', 'turn_rm_faq_to_accordion' );
    }

    Hope this helps. Let us know if you need any other assistance.

Viewing 1 replies (of 1 total)

The topic ‘How to Turn Rank Math FAQ Block into an Accordion’ is closed to new replies.