Hello
once you done insert these two line of Cloudflare CDN blow the <title> tag then u can run your jquery script in an script tag More Information About jquery
Thank you so much. I am afraid that I am not sure where I should insert the lines?
Do you mean on a page? And should the page have a title tag?
Sorry I am not really experienced.
OK, I put the lines into the header.php below the <head> tag to get the jQuery.
I am puzzled – would it be possible for you to tell me what you meant by <title>
tag? Or perhaps somebody else will – I sincerely hope so.
Also, how would I put a script tag related to the jQuery at the bottom of a single page?
Thank you.
-
This reply was modified 7 years, 9 months ago by
mica123.
You don’t have to have a title tag, but you really should, it controls what’s displayed in the browser title bar and can be significant in SEO. As long as your script tags for the jQuery libraries are in the head section of the page, you’re good. There is an optimal placement strategy that’s a little complicated, but anywhere in head will work. Just be sure they occur before any jQuery code is referenced or used.
WP has its own version of jQuery local on your server that it uses by default. You must ensure the WP version and the Cloudflare version are not loaded on the same page, they will conflict with each other. The WP jQuery is mainly used on the back end, but many themes use it on the front end. There’s a workaround to get WP to use another version, but it’s a little involved. I can help further if need be, but it’s better to avoid the need to start with.
The script that uses jQuery must of course occur after the jQuery libraries are loaded. You can put the code in an external file that’s referenced much like the libraries, or you can place the code within script tags right on the page. It can be placed on a template file, such as footer.php. It can even be placed in page content, using the editor’s text tab. If you place script this way, you need to remove any blank lines in the code. Otherwise WP will try to wrap your code in p tags, causing syntax errors.
if you put your cnd link inside the <head> tag you doing great, if you wanna add jquery code in some specific page so you need to install styles n scripts plugin
for more information checkout how to use it.
-
This reply was modified 7 years, 9 months ago by
Abhishek.