StarComp Technology Blog

0

WordPress Function to List all SubCategories

List all SubCategories Tested on: WordPress 3.0.1 $echo = ‘<ul>’ . “\n”; $childcats = get_categories(‘child_of=’ . $cat . ‘&hide_empty=1’); foreach ($childcats as $childcat) { if (1 == $childcat->category_parent) { $echo .= “\t” . ‘<li><a...

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 Reposition the WYSIWYG Editor through JQUERY

Reposition the WYSIWYG Editor through JQUERY Tested on: WordPress 3.0.1 This code will allow you to remove specific meta boxes which wordpress adds by default to the POST and PAGES screens. // REPOSITION WYSIWYG...

0

WordPress Function to Exclude default category from public pages

Exclude default category from public pages Excludes the default category from the front-facing side of the website. Code excludes the admin area, else you’ll have no way to manage posts assigned with the default...

0

WordPress Function to Remove role=”search” attributes for get_search_form()

function remove_role_search($role) { $result = array(); preg_match_all(‘|role=”[^”]*”|U’, $role, $result); foreach ($result[0] as $role_tag) { $role = str_replace($role_tag, ”, $role); } return $role; } add_filter(‘get_search_form’, ‘remove_role_search’);