In this part of Plugin Development 101 you will be introduced to how to load scripts and styles in your WordPress plugins. This is a fundamental element of WordPress plugin development and is used in the vast majority of all plugins. There are many ways that asset loading can be done wrong, so I want to [...]
View PostMaking PHP Variables Available to Your JS
If you have ever written a plugin that uses any form of Javascript, you will probably have come across the problem of passing configuration options from PHP to Javascript. Take an image slider plugin, such as Soliloquy for example: most likely there is a settings page of some kind that lets the user set the [...]
View Post wp_localize_scriptUsing Ajax in Your Plugin and WordPress Admin
This video tutorial walks you through the process of using ajax in the WordPress admin within your own plugins. The end result of this tutorial is not a complete plugin, but it does show the entire process, step by step, of how ajax is utilized in the WordPress dashboard.
View Post add_options_page, Ajax, wp_enqueue_script, wp_localize_scriptUse wp_localize_script, It Is Awesome
One of the challenges you will run into, when developing for WordPress, is finding a way to make your data (which is accessed via PHP) available to your scripts. For example, you might have a popup notification that is displayed when someone clicks a button. The message in this popup, in order to be translatable, [...]
View Post jquery, Michael Martin, Scripts, wp_enqueue_scripts, wp_localize_scriptCreate a Live Search in WordPress with jQuery and Ajax
A live search is a search form that displays the results for your search query as you type. When done right, they can be exceptionally nice to use, and going through the process of building one covers a lot of really important techniques that can be applied to many other areas as well. This in-depth [...]
View Post add_action, Ajax, jquery, search, wp_ajaxDrag and Drop Order for Plugin Options
The drag and drop method of ordering items in an option table is very popular, and also extremely useful. Rather than forcing users to manually enter “order” numbers to sort items the way they want, they can simply click and drag the items into the desired order. I use drag-and-drop ordering quite a bit in [...]
View Post add_option, add_options_page, Ajax, register_setting, sortable, update_optionProcess Ajax Requests Correctly in WordPress Plugins
WordPress provides a set of great tools for processing ajax requests in plugins (and themes). I’m going to give you a quick example of how these tools can be used to accomplish a variety of tasks. For this example, We’ll just be using some simple alerts, but they will serve very well for demonstration purposes.
View Post Ajax, jqueryAdding the Farbtastic Color Picker to your WordPress Widgets
The Farbtastic Color Picker is a fantastic tool for developers and designers to utilize as a way to give their plugin (or theme) users an extra level of control. With Farbtastic, we can allow our users to change the colors of certain elements, such as the background color of our widget, by using an elegant [...]
View Post color picker, farbtastic, jquery, widget, widgetsLoad Scripts if Post has Short Code
This is a really handy trick that I just learned today. Whenever we can, it is always best to only load styles and scripts for our plugins when they are needed. This tutorial will show you how to load stylesheets and scripts only when a post contains the short code that the styles / scripts [...]
View Post Scripts. styles, short codes, shortcodesPost Data with Ajax in WordPress Pugins
- 1
- 2

