Category Archives: Code Snippets

Small code pieces that can be added to WordPress them or plugin files to achieve a particular function.

Upgrade WordPress Themes for depreciated wp_title()

Whenever one opens the header.php of any of the old theme (except the “twenty” themes) then one will find the below code for it: <title><?php wp_title(‘|’, true, ‘right’); ?><?php bloginfo(‘name’); ?></title> The code will basically output the below things for the WordPress Page or Post: Title of WordPress Page/Post or any other page (archive/search) Actual… Read More »

Auto Deactivate a Plugin on Another Plugin Activation

It is sometimes needed to deactivate a certain plugin while your plugin is being activated. The reason for it can be anything, like if two plugins are incompatible or if you are providing premium version of a free or lite plugin. So while activating the premium version you can automatically deactivate the free or lite version in the activation hook of the premium plugin.

Save Plugin or Theme Setting Options using AJAX in WordPress

Almost all of the WordPress plugins provide Plugins specific Options or Settings which provide an ability to the plugin user to change the default behavior of the plugin or specify some site specific values. You can very easily implement the Save Settings using AJAX functionality on your plugins Option Panel using this small code snippet.

Authorship Markup rel=”author” tag coming with WordPress 3.2 in Twenty Ten, Twenty Eleven Themes and Core

Google has announced that they are going to support authorship markup i.e. rel=”author” tag in website’s html. It will be a way to tell the search engine about the author of the content. Based on the data, Google can organize the author’s content in their index system and let people browse that from search results.… Read More »