Delete some text and change html tag with Jquery

<script type=”text/javascript”> jQuery(document).ready(function(){ jQuery(‘.votes’).each(function(){ votes = jQuery(‘strong’,this).html(); jQuery(this).html(‘<div class=”calculated-rating”>’+votes+'</div>’); }); }); </script>

wp_enqueue doesn’t work

First Hint: Copy your parent theme (without modifications) and start a new child theme that only contains the style.css file with the comment and a plain functions.php file. You can move stuff later, but this way you can make sure that nothing interrupts. Solve one task after each other in this plain vanilla setup. Second … Read more

How to include this jQuery File in wordpress?

You should be using wp_register_script() and wp_enqueue_script(), so, for example: add_action( ‘wp_enquque_scripts’, ‘my_script_enqueue’ ); function my_script_enqueue() { wp_enqueue_script( ‘my-jquery’, ‘URL TO THE FILE’, array( ‘jquery’ ) ); } Also, as mentioned by Zack, you should be registering your jQuery as such, as wordpress does not use $ for jQuery by default. jQuery( document ).ready( function( … Read more

Fall Back Google CDN in JavaScript

Scripts don’t get printed at the wp_enqueue_scripts hook, but rather at the wp_print_scripts hook. That said: don’t echo/print scripts, period. Instead, enqueue them properly. Caveat: This method is Plugin territory, and should not be included as Theme code in a publicly distributed Theme. You deregister jQuery, but the step you’re missing is registering and enqueueing … Read more

Custom theme, contact form 7 & fast secure form doesn’t work

I found the solution myself, It had something to do with my code echoing out $content = $page->post_content … echo $content;… I changed this to $content = apply_filters(‘the_content’, $page->post_content); … echo $content;… And now it works! Ref: https://stackoverflow.com/questions/6405974/using-get-pages-in-wordpress-is-stripping-out-my-p-tags

wp_enqueue_ scripts

No, that’s not right. Your script is located at http://www.olliedaw.co.uk/wp-content/themes/Daw%20Refrigeration%20Milk%20Tanks/js/excerpt.js and you’re enqueueing http://www.olliedaw.co.uk/wp-content/themes/DawRefrigerationMilkTanks/js/excerpt.js … those are not the same file! This happens often when you have spaces in your file names and directories. Either remove the spaces or explicitly escape them as %20 when you queue them with wp_enqueue_script().

My jQuery is enqueued properly. So why isn’t it working?

jQuery scripts in WordPress require no-conflict wrappers. Instead of this: $(document).ready(function(){ $(#somefunction) … }); Use this: jQuery(document).ready(function($) { // $() will work as an alias for jQuery() inside of this function }); So, in your case: jQuery(document).ready(function($) { $(“#openbtn”).click(function(){ $(“#openingtimes”).toggle(300); }); });