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

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

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().

Using Bootstrap Switch with WordPress

I had a try with that. You’ll need Twitter Bootstrap‘s CSS file, Bootstrap Switch‘s CSS and JS files. I put all those three files in a folder called assets. functions.php: <?php add_action( ‘wp_head’, ‘rr_bootswitch_meta’ ); add_action( ‘wp_enqueue_scripts’, ‘rr_bootswitch_enqueue’ ); function rr_bootswitch_meta(){ print ‘<meta http-equiv=”X-UA-Compatible” content=”IE=9; IE=8;” />’; } function rr_bootswitch_enqueue(){ wp_enqueue_style(‘bootstrap-css’, get_template_directory_uri() . ‘/assets/bootstrap.min.css’ ); … Read more

Dropdown filtering extremely slow

I’m surprised it’s all that slow but you can remove all but one of the database calls & most of the looping by passing the term data instead of just slugs to my_dropdown_categories() so get_terms() doesn’t have to be called, plus a few other improvements (see comments) eg: function my_dropdown_categories( $taxonomy, $current_selected = ”, $terms … Read more

Reload wordpress shortcodes

If you want to do this via AJAX, on the server side you could do something like the following: add_action( ‘wp_ajax_nopriv_update_shortcode_content’, ‘update_shortcode_content’ ); function update_shortcode_content(){ if( !empty( $_GET[‘new_shortcode_value’] ) ){ $updated_content = do_shortcode( ‘[theshortcode value=”‘ . $_GET[‘new_shortcode_value’] . ‘”]’ ); wp_send_json( array( “content” => $updated_content ) ); } }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)