Get current user data in wordpress

Sangwan Pankaj Reply 09:54
Use wp_get_current_user() to get current users value.
  wp_get_current_user() return WP_User object. 
<?php
    $current_user 
wp_get_current_user();
    
echo 'Username: ' $current_user->user_login '<br />';
    echo 
'User email: ' $current_user->user_email '<br />';
    echo 
'User first name: ' $current_user->user_firstname '<br />';
    echo 
'User last name: ' $current_user->user_lastname '<br />';
    echo 
'User display name: ' $current_user->display_name '<br />';
    echo 
'User ID: ' $current_user->ID '<br />';?>

Add Field to General Settings Page in Wordpress

Sangwan Pankaj Reply 10:15
$new_general_setting = new new_general_setting();

class new_general_setting {
    function new_general_setting( ) {
        add_filter( 'admin_init' , array( &$this , 'register_fields' ) );
    }
    function register_fields() {
        register_setting( 'general', 'profile_message', 'esc_attr' );
        add_settings_field('prof_message', '<label for="prof_message">'.__('Profile Share Message?' , 'profile_message' ).'</label>' , array(&$this, 'fields_html') , 'general' );
     }
    function fields_html() {
        $value = get_option( 'prof_message', '' );
        echo '<textarea id="prof_message" cols="100" rows="3" name="profile_message">' . $value . '</textarea>';
    }
}

post it in your functions.php file. and you can get the values anywhere by using 

$message_Profile = get_option( 'profile_message', '' );

Thanks!

Sangwan Pankaj Reply 23:20
Add this line for instance into functions.php of your theme and you can run shortcodes in widgets.

add_filter('widget_text', 'do_shortcode');

Thats it!

Wordress

Sangwan Pankaj Reply 23:07
WordPress is web software you can use to create a beautiful website or blog. We like to say that WordPress is both free and priceless at the same time.WordPress is a free and open source blogging tool and a content management system (CMS) based on PHP and MySQL, which runs on a web hosting service. Features include a plug-in architecture and a template system. WordPress is used by more than 20% of the top 12 million websites as of March 2014. WordPress is the most popular blogging system in use on the Web.
Wordpress starts with 0.7 version and 3.8.1 is current version.



WordPress has a web template system using a template processor.
1. Themes: WordPress users may install and switch between themes. Themes allow users to change the look and functionality of a WordPress website or installation without altering the information content or structure of the site.

2. Plugins : One very popular feature of WordPress is its plugin architecture which allows users and developers to extend its abilities beyond the core installation. WordPress has a database of over 26,000+ plugins, each of which offers custom functions and features enabling users to tailor their sites to their specific needs.

Sangwan Pankaj Reply 09:47
PHP is a server side scripting language. No, it is no the same as HTML. HTML is simply intended to display websites. PHP allows you to interact with them. You can use it to gather information from online forms, interact with a database, and display dynamic information.
 



Think of HTML as the "look" and PHP as the "brains" of a website.
Copyright by GhostPHP. Powered by Blogger.

Search

Recent Post

Popular Posts

Follow us