Thread Starter
tkse
(@tkse)
Or not.
The wp_enqueue_scripts didnt fix the problem with the admin-bar.
he wp_enqueue_scripts didnt fix the problem with the admin-bar.
Yeah. If you’re dequeueing the version of jQuery bundled with WordPress – i.e. the version of jQuery against which the Admin Bar and other core code has been tested – and enqueueing your own version of jQuery, you assume some degree of risk of breaking things – things such as the Admin Toolbar.
Thread Starter
tkse
(@tkse)
Back at zero then.
Any suggestions on how I should add my own script without breaking anything then?
Any suggestions on how I should add my own script without breaking anything then?
Is there any reason that you can’t just use the core-bundled version of jQuery?
Thread Starter
tkse
(@tkse)
No, not really. But how would I go about writing jQuery using that? Just throwing a script in there doesnt work so thats kind of where Im lost. 😛
In the last version of WordPress I used, I could just link to the jQuery-file in the header and write my script, which in 3.3.1 causes problems.
No, not really. But how would I go about writing jQuery using that? Just throwing a script in there doesnt work so thats kind of where Im lost. 😛
Are you trying to enqueue a jQuery library, or are you trying to write an inline script using jQuery? If you’re trying to write an inline script (e.g. for a slider or something), that should work just fine. Just be aware that WordPress uses no-conflict, so you can’t nakedly use $ as a shorthand for jQuery.
In the last version of WordPress I used, I could just link to the jQuery-file in the header and write my script, which in 3.3.1 causes problems.
…in which case, we’re right back where @esmi started: wp_enqueue_script().
Thread Starter
tkse
(@tkse)
I’m trying to write a script, but I thought I needed to get the library-file first, because when I just write a script it doesnt work.
<script>
jQuery(document).ready(function(){
jQuery('.single #recent-posts-2').appendTo('.topgrid');
});
</script>
…in which case, we’re right back where @esmi started: wp_enqueue_script().
That again causes problems. :S