How do I add Javascript and CSS files into WordPress?

For your purpose enqueue is the key: wp_enqueue_script() wp_enqueue_style() You can consult this question: How to enqueue the style using wp_enqueue_style() for style enqueue. For scripts enqueue I recently did as: // ENQUEUE JAVASCRIPTS FOR CUSTOM PURPOSE function scripts_for_something() { wp_register_script( ‘my-scripts’, get_template_directory_uri() . ‘/js/my-scripts.js’ ); wp_enqueue_script( ‘my-scripts’ ); } add_action( ‘admin_enqueue_scripts’, ‘scripts_for_something’ ); admin_enqueue_scripts … Read more

Accessing Advanced Custom Fields with Repeater using jQuery instead of PHP

Assuming you registered or enqueued your jQuery script using wp_enqueue_scripts and assigned it a proper handle, this function will allow you access to the postage_prices fields in jQuery via a variable postagePricesArray.prices. You need to replace %YOUR_SCRIPT_HANDLE% with your jQuery script’s actual handle or this variable may not become accessible. function localize_postage_prices() { global $post; … Read more

How can I use jQuery maphilight?

You could use this as a shortcode. Put this in your content. [maphilight] Register the shortcode. // Add Shortcode function maphilight_shortcode() { ?> <img id=”ImageMap1″ src=”https://wordpress.stackexchange.com/questions/211561/<?php echo get_stylesheet_directory_uri() .”/jq/cc.jpg’; ?>” border=”0″ width=”1212″ height=”812″ orgWidth=”1212″ orgHeight=”812″ usemap=”#image-maps-2015-12-08-070211″ alt=”” /> <map name=”image-maps-2015-12-08-070211″ id=”ImageMapsCom-image-maps-2015-12-08-070211″> <area shape=”rect” coords=”1210,810,1212,812″ alt=”Image Map” style=”outline:none;” title=”Image Map” href=”http://www.image-maps.com/index.php?aff=mapped_users_0″ /> <area alt=”as” title=”as” href=”http://www.image-maps.com/as” … Read more

Use WordPress Built In Jquery

The jQuery object is jQuery rather than $. See noConflict wrappers in wp_enqueue_script for some examples. jQuery(document).ready(function($) { // Inside of this function, $() will work as an alias for jQuery() // and other libraries also using $ will not be accessible under this shortcut });

What is calling jquery?

If I am correct, those two js files are “only” loaded by WP itself for use in the back-end(Admin), but not (and WP would not load them if no need for it) in the front-end. As soon a plugin needs them, they will be loaded (e.g. through a function) in the front-end. (which seems not … Read more

Does anyone know how to load jquery in the footer?

Use the 5th parameter when using the wp_enqueue_script function: Normally, scripts are placed in <head> of the HTML document. If this parameter is true, the script is placed before the end tag. This requires the theme to have the wp_footer() template tag in the appropriate place. Default: false

Jquery in IE, fully messed up

After a long debugging, I found that the class .nivoSlider was not having a definite height, so I gave a height height:288px !important; and woila, it worked,

jQuery cycle thumbnails?

I use the jQuery cycle on the home page of http://getwellgabby.org/. You can inspect the elements to see what’s going on with CSS here. For the PHP, I wrote a custom home page template as part of a child theme based on TwentyTen. There are two loops in the page: One that gets the static … Read more

Carousel Hover Image

I figured it out!! I added this piece of jQuery: <script type=”text/javascript”> <!– $(function() { jQuery(“.photos a”).hover(function() { var offset = $(this).offset(); var id_post = $(this).attr(“id”); jQuery(“.hover”).find(“span[id=”+id_post+”]”).css(“left”, (offset.left-312)+”px”); jQuery(“.hover”).find(“span[id=”+id_post+”]”).show(); }, function() { jQuery(“.hover”).find(“span”).hide(); }) }); //–> </script> and added an additional loop: <div class=”hover”> <?php query_posts( ‘category_name=photos&posts_per_page=-1’ ); ?> <?php if ( have_posts() ) : … Read more