StarComp Technology Blog

0

WordPress Function to Displaying information for logged in users

Displaying information for logged in users if ( is_user_logged_in() ) { } is not working in functions.php file. You can use this code: if ( !function_exists(‘is_user_logged_in’) ) : function is_user_logged_in() { $user = wp_get_current_user();...

0

WordPress Function to Remove Admin (User #1) from User list

Remove Admin (User #1) from User list function your_pre_user_query($user_search) { $user = wp_get_current_user(); if ($user->ID!=1) { global $wpdb; $user_search->query_where = str_replace(‘WHERE 1=1’, “WHERE 1=1 AND {$wpdb->users}.ID<>1”,$user_search->query_where); } } add_action(‘pre_user_query’,’your_pre_user_query’);

0

WordPress Function to Get Attributes of Given Thumbnail

Get Attributes of Given Thumbnail Use this function with the loop to determine width, height and URL of a thumbnailed image. Very handy for assigning a thumbnailed image as a background element via inline...

0

WordPress Function to Remove WordPress 3.3 Admin Bar Menu Items

Remove WordPress 3.3 Admin Bar Menu Items function dashboard_tweaks() { global $wp_admin_bar; $wp_admin_bar->remove_menu(‘wp-logo’); $wp_admin_bar->remove_menu(‘about’); $wp_admin_bar->remove_menu(‘wporg’); $wp_admin_bar->remove_menu(‘documentation’); $wp_admin_bar->remove_menu(‘support-forums’); $wp_admin_bar->remove_menu(‘feedback’); $wp_admin_bar->remove_menu(‘view-site’); } add_action( ‘wp_before_admin_bar_render’, ‘dashboard_tweaks’ ); Reference: http://pastebin.com/Wrk0JPxw

0

WordPress Function to Cross Taxonomy Tags Query

A cached query that outputs a get_tags() like HTML string of all tags for a given Taxonomy parameter defaulting to a Category. You can use $where_slug and $where_tax to get post tags filtered by...

0

WordPress Function to Add a Login Link to wp_nav_menu

Add a Login Link to wp_nav_menu //ADD LOGIN LINK TO MENU add_filter(‘wp_nav_menu_items’, ‘add_login_logout_link’, 10, 2); function add_login_logout_link($items, $args) { $loginoutlink = wp_loginout(‘index.php’, false); $items .= ‘<li>’. $loginoutlink .'</li>’; return $items; }