StarComp Technology Blog

0

WordPress Function to Fixed: Remove Default WordPress Meta Boxes

Fixed: Remove Default WordPress Meta Boxes This was very handy but had some errors // REMOVE META BOXES FROM DEFAULT POSTS SCREEN function remove_default_post_screen_metaboxes() { remove_meta_box( ‘postcustom’,’post’,’normal’ ); // Custom Fields Metabox remove_meta_box( ‘postexcerpt’,’post’,’normal’...

0

WordPress Function to Return the number of comments

Return the number of comments This is like count_user_posts(), but returns the number of comments instead: function count_user_comments($id) { global $wpdb; $users = $wpdb->get_var(” SELECT COUNT( * ) AS total FROM $wpdb->comments WHERE comment_approved...

0

WordPress Function to Extending Auto Logout Period

Extending Auto Logout Period Tested on: WordPress 3.0.1 Using the code below you can increase the time cookies are kept and therefor users who are logged in remain logged in longer: function keep_me_logged_in_for_1_year( $expirein...

0

WordPress Function to Grab all custom fields globally

Grab all custom fields globally function get_custom_field($key, $echo = FALSE) { global $post; $custom_field = get_post_meta( $post->ID, $key, true ); if ( $echo == false ) return $custom_field; echo $custom_field; } Then call the...

0

WordPress Function to Remove Private and Protected Prefix

Remove Private and Protected Prefix This function removes the “Privite:” prefix from posts and pages marked private. Useful for content only visible to logged in users or groups. function the_title_trim($title) { $title = attribute_escape($title);...