Viewing 5 replies - 1 through 5 (of 5 total)
  • Gareth

    (@catapult_themes)

    Hi

    I don’t think this is related to this plugin. I suspect it might be a different plugin or your theme?

    MattPurland

    (@mattpurland)

    Hi,

    opr18 is correct. The script (add_js function in this case) is injecting the javascript before any queued javascript files. This produces the following scenario as part of wp_footer() (tidied up for eligibility):

    <script type="text/javascript">
    	jQuery(document).ready(function($){
    		if(!catapultReadCookie("catAccCookies")){ // If the cookie has not been set then show the bar
    			$("html").addClass("has-cookie-bar");
    			$("html").addClass("cookie-bar-bottom-bar");
    			$("html").addClass("cookie-bar-bar");
    		}
    	});
    </script>
    <script type='text/javascript' src='<domain></wp-includes/js/admin-bar.min.js?ver=4.4.2'></script>
    <script type='text/javascript' src='<domain>/wp-content/themes/<theme>/bower_components/jquery/dist/jquery.js?ver=2.1.1'></script>

    This is due to the lack of priority on the action for add_js. Setting the priority of the jquery enqueue in functions.php doesn’t work, so the only solution is to add priority to the plugin add_action as per opr18’s suggestion.

    Plugin author: I’d recommend adding priority 1000 to all actions in init() as per add_notification_bar to avoid this issue.

    Gareth

    (@catapult_themes)

    Okay, I will take another look.

    I confirmed that by giving the add_action ( ‘wp_footer’, array ( $this, ‘add_js’ ) ); priority 900, works.

    Please add the priority to the next update.
    Thank you ??

    Gareth

    (@catapult_themes)

    Okay – this priority has now been added.

    Thanks to everyone for their contribution.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘jQuery is not defined – solution’ is closed to new replies.