Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter Luke Alford

    (@luke-alford)

    double post….

    Plugin Author jewlofthelotus

    (@jewlofthelotus)

    @luke Alford – Interesting, this is the 2nd time I’ve seen this happen. Everything is on the page except for the script needed to setup the quiz functionality.

    You could try commenting out these lines, which are what I suspect is blocking the script from loading – however, be sure you have server access or a really good customer support service in the case that getting rid of those causes an error on the site and you need to revert the change. https://github.com/jewlofthelotus/SlickQuiz-WordPress/blob/master/php/slickquiz-front.php#L39-L41

    Thread Starter Luke Alford

    (@luke-alford)

    Thanks for the reply,

    I’ve tried commenting out those couple of lines of code, But get the following PHP error

    Parse error: syntax error, unexpected ‘$mainPluginFile’ (T_VARIABLE), expecting function (T_FUNCTION) in /home/energyspace/public_html/wp-content/plugins/slickquiz/php/slickquiz-front.php on line 43

    I’ve revert it back so I can still use the site.

    Plugin Author jewlofthelotus

    (@jewlofthelotus)

    @luke Alford Hmmm… I’m still not sure why this is happening, but I hope to dig in some more later this week and hopefully push a fix out. Stay tuned!

    Thread Starter Luke Alford

    (@luke-alford)

    @jewlofthelotus Thanks for the reply,

    I’ve updated too 1.3.5 Still have nothing on front-end but can preview quiz’s via Admin.

    Plugin Author jewlofthelotus

    (@jewlofthelotus)

    @luke Alford – As a work around until I can figure out why the scripts aren’t loading for you, you could load them manually by placing the following code at the top of your footer.php theme template.

    <link rel='stylesheet' id='slickquiz_css-css'  href='https://energyspace.heidesignhost.com.au/wp-content/plugins/slickquiz/slickquiz/css/slickQuiz.css?ver=3.9.2' type='text/css' media='all' />
    <link rel='stylesheet' id='slickquiz_front_css-css'  href='https://energyspace.heidesignhost.com.au/wp-content/plugins/slickquiz/css/front.css?ver=3.9.2' type='text/css' media='all' />
    <script type='text/javascript' src='https://energyspace.heidesignhost.com.au/wp-content/plugins/slickquiz/slickquiz/js/slickQuiz.js?ver=3.9.2'></script>

    Let me know if you add them and still see problems.

    This is interesting because I have encountered these errors before. In my case I simply added a hidden quiz in the page like this:

    <div style='visibility: hidden'>[slickquiz id='1']</div>

    Which, inelegant as it may be, forces the slickquiz js to load only on that page.

    BTW, I used firefox to inspect this above-mentioned-URL and saw a more specific error:

    TypeError: $(...).slickQuiz is not a function (quiz-test:376)

    Digging in a little further, I found this bit of js at the bottom of the quiz-test page (near line 376):

    <script type="text/javascript">
               jQuery(document).ready(function($) {
                   $("#slickQuiz1").slickQuiz({
                        json: ...
                        ...
                        disableScore:                false,
                        disableRanking:              false,
                        scoreAsPercentage:           false
                    });
                });
           </script>

    I am not sure what this is supposed to do, but it seems likely to be the cause of the problem.

    Plugin Author jewlofthelotus

    (@jewlofthelotus)

    @mirgcire$("#slickQuiz1").slickQuiz({...}); is the code that actually initializes the quiz, sets the content and other quiz settings. That calls the slickQuiz method that is in the slickquiz.js file.

    It’s returning a “is not a function” error because, for whatever reason, the slickquiz.js file is not loading on the page and therefore the slickQuiz function is nowhere to be called. I’ve run across this issue a few times lately and I’m not sure what is causing the scripts not to load, but that is a high priority for me to address and fix.

    hello,
    wanted to join in, had a similar issue, debugged the whole theme & just found these two lines failed me:

    https://github.com/jewlofthelotus/SlickQuiz-WordPress/blob/master/php/slickquiz-front.php#L28-L29

    my setup is that the client adds the shortcode in an Advanced Custom Fields wysiwyg field. they don’t run ‘the_content’, but have their own ‘acf_the_content’. think their might be a lot of use cases where neither the_content or widget_text are run and load_resources will never be triggered. like ‘echo do_shortcode(‘[slickquiz id=1]’);’ in template files. think this might be the issue for the cases above as well.

    for now I solved it like you suggested, but with an extra wp_enqueue_script.

    Plugin Author jewlofthelotus

    (@jewlofthelotus)

    @veerle Verbert Thanks for that insight! I’ve been suspecting it’s been non the_content and non widget_text areas that have been causing these problems. So, while I’m not entirely happy with this solution, the fix for now is to just load the quiz scripts all the time rather than specifically checking for the shortcode to be present in specific areas.

    @luke Alford, @mirgcire – The latest update aims to fix this issue, please let me know if you’re still having problems after updating!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Uncaught TypeError: undefined is not a function’ is closed to new replies.