StarComp Technology Blog

0

WordPress Function to Quickly Determine Server & Environment Details

Quickly Determine Server & Environment Details If you have multiple servers and multiple environments such as development, QA, and production environments, this can be very useful. For my systems, environment is determined by the...

0

WordPress Function to show posts and media of the logged-in Author

Tested on: WordPress 3.4.1 By default, WordPress allows Authors to see the titles of other users posts, unpublished drafts, and all media, even though they cannot be edited. Use this code to only allow...

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...