[Resolved] Functions php or Elements

Home Forums Support [Resolved] Functions php or Elements

Home Forums Support Functions php or Elements

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #2211299
    Christos

    Hi. I have a piece of code to add to change Rankmath FAQ into accordion faqs display.
    There is a CSS part and a js part. https://rankmath.com/kb/turn-faq-block-into-accordion/
    About the functions.php part. Is there a different way to add that using elements or not? I want to avoid the Child theme.

    #2211303
    Christos

    For example, check https://www.channeldoubler.com/staging/el/
    It works when added as hook element for Entire website but some script is showing at the top. why?

    #2211340
    David
    Staff
    Customer Support

    Hi there,

    change the Hook to wp_footer
    And replace the hooks content with just the <script> ie:

    <script>
        jQuery(document).ready(function() {
            var faqBlock = jQuery("div#rank-math-faq");
            var faqItems = faqBlock.find("div.rank-math-list-item");
            faqItems.bind("click", function(event) {
                var answer = jQuery(this).find("div.rank-math-answer");
                if (answer.css("overflow") == "hidden") {
                    answer.css("overflow", "visible");
                    answer.css("max-height", "100vh");
                } else {
                    answer.css("overflow", "hidden");
                    answer.css("max-height", "0");
                }
            });
        });
    </script>
    #2211350
    Christos

    ΟΚ seems to work. thanks.

    #2211414
    David
    Staff
    Customer Support

    You’re welcome

    #2213989
    Christos

    Hi. The code is not working in responsive. Any ideas?
    https://www.channeldoubler.com/staging/

    #2214008
    David
    Staff
    Customer Support

    Its not working on my desktop either.
    Edit the Element and set the Priority to a really high value eg. 1000 this will ensure the scripts loads after jQuery is loaded.

    #2214011
    Christos

    OK. seems to be solved.

    #2214026
    David
    Staff
    Customer Support

    Glad to hear that!

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