Add Custom Fields to User Profile in WordPress

This post will teach you that how to add custom fields to user profile in WordPress. For example you want to add some extra information like user’s facebook link , hobbies, games he plays etc. Add extra fields to a wordpress user profile is easy. Following code will show that how to add fields. Continue reading “Add Custom Fields to User Profile in WordPress”


List of WordPress filters and hooks

You can get list of all registered filters and hooks in wordpress using global variables  $wp_filter and $wp_actions. Please see following example.

Example 1
global $wp_filter , $wp_actions;

echo '<pre>';
    print_r( $wp_actions );
    print_r( $wp_filter );
echo '</pre>';

If you want to get list of a specific filter then use as follows example.

Example 2
gloabl $wp_filter;
$spec_filter = 'the_content';

echo '<pre>';
    print_r( $wp_filter[ $spec_filter ] );
echo '</pre>';

Adding JavaScript in WordPress

You can add javascript in WordPress using <script> tag , but I think this way may increse possibility to conflict js with other js. So a proper way to include scripts by using wp_enqueue_script() function. This is main function use to insert Javascript into a WordPress page. As it name suggest add a script to a queue of javascripts.

Syntax : wp_enqueue_script( ‘script-name’, get_template_directory_uri() . ‘/js/example.js’, array(), ‘1.0.0’, true );

Use WordPress default jQuery UI “datepicker” in your theme

First write following code in template file. These code will include js and datepicker class in the template.

wp_enqueue_style('jquery-ui-css', '');

Continue reading “Use WordPress default jQuery UI “datepicker” in your theme”