Display DB Queries, Time Spent and Memory Consumption

Posted by & filed under WordPress.

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

Continue reading →

Change the length of Exerpt

Posted by & filed under WordPress.

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

Posted by & filed under WordPress.

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’] =

Continue reading →