• Resolved ads1018

    (@ads1018)


    I know wordpress comes bundled with the jquery library but I can’t find any thorough tutorials online on how to call for the scripts in my theme. How do I do this?

Viewing 9 replies - 1 through 9 (of 9 total)
  • You have to load the jQuery library in your theme’s header.php file

    1) in header.php find the line <?php wp_head(); ?>

    2) BEFORE that line, add this line
    <?php wp_enqueue_script(‘jquery’); ?>

    3) AFTER that line, paste in your jQuery scripts.

    Does this answer your question?

    Hi,

    Have a check with this plugin:

    https://www.ads-software.com/extend/plugins/jquery-lightbox-balupton-edition/

    Thanks,

    Shane G.

    But jQuery library gets loaded by default, isn’t it?

    You can also look at the alternative use of Google Ajax jQuery libraries through this plugin:

    https://www.ads-software.com/extend/plugins/use-google-libraries/

    S.K

    Thread Starter ads1018

    (@ads1018)

    Thread Starter ads1018

    (@ads1018)

    Thread Starter ads1018

    (@ads1018)

    Okay I did steps one and two. Can you give me an example on how to/where to paste a jquery script included in the wordpress library? I’m not sure what exactly I’m supposed to paste. Sorry I’m new to javascript.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="https://www.w3.org/1999/xhtml" <?php language_attributes() ?>>
    <head profile="https://gmpg.org/xfn/11">
    	<title><?php wp_title( '-', true, 'right' ); echo wp_specialchars( get_bloginfo('name'), 1 ) ?></title>
    	<meta http-equiv="content-type" content="<?php bloginfo('html_type') ?>; charset=<?php bloginfo('charset') ?>" />
    	<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url') ?>" />
    <?php wp_enqueue_script('jquery'); ?>
    
    <?php wp_head() // For plugins ?>
    	<link rel="alternate" type="application/rss+xml" href="<?php bloginfo('rss2_url') ?>" title="<?php printf( __( '%s latest posts', 'sandbox' ), wp_specialchars( get_bloginfo('name'), 1 ) ) ?>" />
    	<link rel="alternate" type="application/rss+xml" href="<?php bloginfo('comments_rss2_url') ?>" title="<?php printf( __( '%s latest comments', 'sandbox' ), wp_specialchars( get_bloginfo('name'), 1 ) ) ?>" />
    	<link rel="pingback" href="<?php bloginfo('pingback_url') ?>" />
    </head>
    
    <body class="<?php sandbox_body_class() ?>">
    
    <div id="wrapper" class="hfeed">
    
    	<div id="header">
    		<h1 id="blog-title"><span><a href="<?php bloginfo('home') ?>/" title="<?php echo wp_specialchars( get_bloginfo('name'), 1 ) ?>" rel="home"><?php bloginfo('name') ?></a></span></h1>
    		<div id="blog-description"><?php bloginfo('description') ?></div>
    	</div><!--  #header -->
    
    	<div id="access">
    		<?php sandbox_globalnav() ?>
    	</div><!-- #access -->

    Hi

    what is it you want jQuery to do? You need a script, or a jQuery plugin, to do it.

    …how to/where to paste a jquery script included in the wordpress library

    I don’t think I understand this.

    Like stvwlf asked, what is it you want jQuery to do?

    kichu. No, jQuery doesn’t load by default on the front end. It is available for use by default. That is, you don’t have to install the libraries, just activate them. But a lot of plugins and themes do load jQuery so it might look like it loads by default.

    Yep. Checked it.

    Thanks a bundle.

    S.K

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Jquery and WordPress’ is closed to new replies.