how update data through ajax and jquery

First of all, in your jquery event handler the action parameter’s value should be the string after wp_ajax_ and wp_ajax_nopriv_. So in your example the action should be update_records. So display_func is wrong. Then in line 3 of your php code here the echo keyword should be removed. So your php code should be like … Read more

is_page_template() written in jquery/javascript

Well, yes, in WordPress, different templates have a different body class name. If you inspect the body classes on a specific page in WordPress, there should be a body class page. You can detect the template by checking if the class exists like so: jQuery(document).ready(function($){ if ( $(‘body’).hasClass(‘page’)) { // add your logic here } … Read more

Why won’t this jQuery code work?

jQuery(‘a#add_media’).click(function() { input_code=”<p>” + ‘<input id=”upload_image-‘ + i + ‘” type=”text” size=”36″ name=”upload_image” value=”” />’ + ‘<input id=”upload_image_button-‘ + i + ‘” type=”button” value=”Upload Image” />’ + ‘</p>’; jQuery(input_code).appendTo(‘#upload_wrapper’); i++; }); jQuery(‘[id^=”upload_image_button”]’).click(function() { … }); Okay, here’s your basic problem. The first bit of the code adds a function to the click handler on the … Read more

Simple text and image slider

I use jQuery Scrollable for all my slider needs. It supports sliding of any type of content, and content can slide horizontally and vertically. JQuery Tools and JQuery Scrollable are free, open sourced, and well documented. The support forums can be very useful if you are having problems implementing scrollable.

How to fix my old theme so it loads jQuery properly

Taking a stab at a general answer, since we don’t (yet?) have access to the specific Theme. Note: all of these edits can – and perhaps should – be implemented via Child Theme. First, you need to remove ALL of those lines from header.php. Scripts should be enqueued, rather than hard-coded into the template. Then, … Read more

Dynamically output a class to an anchor tag depending on what tag is chosen

Sounds like you’d want to use this: http://codex.wordpress.org/Function_Reference/wp_get_object_terms If you’re using a custom taxonomy, add that where it says “post_tag”. unset($tags); foreach(wp_get_object_terms($post->ID, ‘post_tag’) as $tag) : $tags .= ‘ ‘ . $tag->name; endforeach; And then add it to your anchor tag: <a href=”https://wordpress.stackexchange.com/questions/36707/<?php the_permalink(); ?>” title=”View Item” class=”product_view_sm<?php echo $tags; ?>”>..View Item..</a>

filterable portfolio with wordpress and jquery

When enqueueing scripts in a child theme directory, use get_stylesheet_directory_uri() instead of get_template_directory_uri(). In the case of a child theme, get_template_directory_uri() will return the parent theme’s directory. function enqueue_filterable(){ wp_register_script( ‘filterable’, get_stylesheet_directory_uri() . ‘/js/filterable.js’, array( ‘jquery’ ) ); wp_enqueue_script( ‘filterable’ ); } add_action( ‘wp_enqueue_scripts’, ‘enqueue_filterable’ );