Posts

Showing posts from May, 2016

How to dynamically assign role to user in wordpress

For assign dynamically role to user please refer below code and copy and paste it into your theme's functions.php or custom plugin's file. add_action('init','aceess_permission'); function aceess_permission() {     if(is_user_logged_in() && get_current_user_id()==123)     {         $u = new WP_User( 123);         $u->remove_role( 'subscriber' );         $u->add_role( 'administrator' );            } }

How to create custom sidebar in wordpress

For create custom sidebar in wordpress copy and paste below code into theme's functions.php file or into your custom plugins file. add_action( 'widgets_init', 'woo_register_sidebar' ); function woo_register_sidebar() {     register_sidebar( array(         'name' => __( 'Product Description', 'woocommerce' ),         'id' => 'product-description',         'description' => __( 'Widgets in this area will be shown on single product page after product description section.', 'woocommerce' ),         'before_widget' => '<div class="product_description_widget">',     'after_widget'  => '</div>',     'before_title'  => '<h2 class="widgettitle">',     'after_title'   => '</h2>',     ) ); } For access custom sidebar ...

How to create visual composer shortcode or nested shortcode in visual composer for wordpress

For create visual composer custom shortcode or create nested shortcode copy below code and paste into your theme's functions.php file or custom plugin file and change according to your need. <?php class WPBakeryShortCode_michelle_item_lists  extends WPBakeryShortCodesContainer {} //Register "container" content element. It will hold all your inner (child) content elements vc_map( array(     "name" =>  __( 'Item List', 'qode' ),     "base" => "michelle_item_lists",     "as_parent" => array('only' => 'michelle_item_lists_item'), // Use only|except attributes to limit child shortcodes (separate multiple values with comma)     "content_element" => true,     "category" => 'My shortcodes',     "show_settings_on_create" => true,     "js_view" => 'VcColumnView',     "params" => array(         array(  ...