function performance( $visible = false ) { $stat = sprintf( ‘%d queries in %.3f seconds, using %.2fMB memory’, get_num_queries(), timer_stop( 0, 3 ), memory_get_peak_usage() / 1024 / 1024 ); echo $visible ? $stat : “<!– {$stat} –>” ; } Then this code below the code above which will automatically insert the code above into the
Posts By: Renat
Change the length of Exerpt
By default all excerpts are capped at 55 words. Utilising the code below you can override this default settings: function new_excerpt_length($length) { return 100; } add_filter(‘excerpt_length’, ‘new_excerpt_length’); This example changes the excerpt length to 100 words, but you can use the same method to change it to any value.
Add Custom User Profile Fields
Place the code below into your functions.php file to add custom user profile fields. Edit or add lines as you see fit. Remember not to remove the line: return $contactmethods; otherwise this won’t work. // CUSTOM USER PROFILE FIELDS function my_custom_userfields( $contactmethods ) { // ADD CONTACT CUSTOM FIELDS $contactmethods[‘contact_phone_office’] = ‘Office Phone’; $contactmethods[‘contact_phone_mobile’] =
Set a maximum number of post revisions to avoid DB bloat
Default is infinite, this will set it to only remember last 5 edits: /** * Set the post revisions unless the constant was set in wp-config.php */ if (!defined(‘WP_POST_REVISIONS’)) define(‘WP_POST_REVISIONS’, 5);