Tag Info

New answers tagged

0

SOLVED: can't figure out the best way to update my question, sorry! Thank you Rarst the link you provided helped me figure this out: add_action('wp_enqueue_scripts', 'watercolor_js_scripts'); function watercolor_js_scripts(){ if (!is_admin()) { wp_register_script('cycle2', get_template_directory_uri() . '/js/cycle2.js', array('jquery'), ...


1

Use wp_register_script & wp_enqueue_script to enqueue the scripts the right way. add_action( 'wp_enqueue_scripts', 'enqueue_my_script' ); function enqueue_my_script() { wp_register_script( 'my-script', get_template_directory_uri() . '/cycle2.js', array( 'jquery' ) ); wp_register_script( 'enq-jquery', ...


0

Your snippet seems mostly ok, except that dependency is a list and should be array('jquery'). Also wp_enqueue_scripts should be use as more appropriate. You can check out Codex documentation for a complete example, see Example of Automatic Dependency Loading.


-1

<script type="text/javascript"> var $j = jQuery.noConflict(); $j(document).ready(function() { $j("#manita-imagen").mouseover(function(){ //$j(this).animate({ opacity: "hide" }) // alert('asd'); $j(this).effect("shake", { times:3 }, 300); }); }); </script>


0

Exchange $ for jQuery. WordPress has default jQuery. Like the following Example: jQuery("#path2936, #path2932, #path2934, #path2902, #path2898, #path2906, #path2896, #path2914, #path2922, #path2920, #path2930").click(function() { jQuery('html, body').animate({ scrollTop: jQuery("#diventapromotore").offset().top }, 2000); }); If it's still ...


0

To load your single.php template, first you need to move your functions.php code <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <div class="entry-content"> <?php the_content(); ?> </div> ...


1

Your button was added dynamically. So you can not bind event in simple way. As button is added after DOM is fully ready. You need to bind it with the refrence of document or body jQuery(document).on('click', '#readmore', function(e){ e.preventDefault(); alert("you clicked the button"); jQuery("#bodytext").css("display", "block"); }); Read ...


0

Register the script first, then ask WP to enqueue it : function add_my_script() { wp_register_script('av_s', get_template_directory_uri() . '/js/av_s.js', array('jquery')); wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js', array('jquery'),'1', true); wp_enqueue_script('av_s'); ...


0

I did end up figuring this out and went with 2) To keep it simple for content creators I told them to make sure the name of the transcript the same name for the pdf. When a new song comes in a playlist, I grab the text from the current track playing, parse the string with Wordpress file name URL rewriting (such as " " reverts to "-" I believe; this is an ...


2

Ok, I solve this with the help of @TheDeadMedic's help. I use wordpress cookiepath constant and it works on wordpress perfectly. Here is the jquery code: jQuery(document).ready(function () { // baking cookie ;p function set_cookie(ID) { document.cookie = ID + "=opened; path=<?php echo COOKIEPATH ...


2

Anyway, basically Hody_McGee gave the answer in his comment: You could use wp_localize_script(). As it states in the Codex: [wp_localize_script()] can be used to make any data available to your script that you can normally only get from the server side of WordPress. How do we do this? <?php add_action( 'wp_enqueue_scripts', 'register_scripts' ...


0

Use both the_excerpt() and the_content(). Keep the_content() hidden, and after the_exceprt() add your Icon. When someone clicks this Icon, toggle between the_excerpt() and the_content().


1

There is a way out, use complete instead of success or done posts = $.ajax({ type: 'GET', url: ajaxurl, async: false, dataType: 'json', data: { action : 'getHotelsList' }, complete: function(results) { and try to remove async:false if problem persists


1

Instead of rolling-your-own, just use a plugin designed specifically for that purpose for the CDN in question: https://wordpress.org/plugins/use-google-libraries/


0

I believe one of the comments should fix your issue given how you mentioned that the code works outside of WordPress, which does in fact appear to be a problem with your references to $ instead of jQuery. Also, i have written a post on this exact topic with step by step instruction, you can see it here: Ajax Calls in WordPress


0

First of all when I want to make a AJAX code I start the ajax registering by adding a ajax url accessible from the js. wp_localize_script( "combo_checkout_iRange", "server_obj", array( "ajax_url"=>admin_url("admin-ajax.php") ) ); Than from the javascript file I could call the ajax server like that: jQuery.post(server_obj.ajax_url, ...



Top 50 recent answers are included