WordPress Featured Post Slider

This is one of those things you probably have to do yourself, even though there are some slider plugins, they are difficult to customize. Using a jquery slider is pretty straightforward, they are usually just controlled with ID’s and CLASS’s, so you can wrap any WordPress code, for instance a wp_query (for featured posts). toscho’s … Read more

Best Way to Include Scripts on a Specific Template Page

The following (in your theme’s functions.php) will register your script, and set jQuery as a dependency. So when you enqueue it, jQuery will also be enqueued. function my_scripts_method() { // register your script location, dependencies and version wp_register_script(‘my_custom_script’, get_template_directory_uri() . ‘/js/custom_script.js’, array(‘jquery’), ‘1.0’ ); } add_action(‘wp_enqueue_scripts’, ‘my_scripts_method’); You can then enqueue your script one of … Read more

Basic WordPress AJAX Call

WordPress AJAX uses actions to connect your jQuery action with a traditional WordPress action. Take a look at the example WordPress provides in their docs. There’s 2 hooks: add_action( “wp_ajax_{$jquery_action_string}”, “callback_function_name” ); The above will only work for authenticated ( logged in ) users. For non-logged-in users we use nopriv: add_action( “wp_ajax_nopriv_{$jquery_action_string}”, “callback_function_name” ); So … Read more

Proper way to load a single post via Ajax?

Here is my view: Load it inside your single.php why use ajax at all? Google wont be able to see this (using most crawlers). In any case – here is the right way to return the data… please note that you can use get_post or wp_query. up tp you. JS Part: jQuery(document).ready(function($) { $.post(ajax_object.ajaxurl, { … Read more

Adding fields to the media uploader with jquery listeners

From Blackbone.js website: render is the core function that your view should override, in order to populate its element (this.el), with the appropriate HTML. The convention is for render to always return this. So, I have modified the code a little bit to add jQuery change listener. function add_gallery_type_option(){ ?> <script type=”text/html” id=”tmpl-my-custom-gallery-setting”> <label class=”setting”> … Read more

Passing a varible from jQuery to PHP

First, don’t use query_posts. Second… I think this can be done with AJAX but is there a more simple method and give me a clean URL? PHP runs on the server. Items are “clicked” on the client machine. The only way to pass that “clicked” value back to PHP is via AJAX. Within a WordPress … Read more

Is it worth updating WP admin to jQuery 1.5?

Well, as for performance release post says: In this release we’ve also been able to improve the performance of some commonly-used traversal methods: .children(), .prev(), and .next(). The speed-ups that we’re seeing are quite substantial (potentially many many times faster, depending upon the browser). On other hand replacing jQuery on admin side is rarely good … Read more

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