Posted by & filed under WordPress.

Adding this snippet to your WordPress theme will let you check to see if a post contains the gallery shortcode. Add this code to the single.php template of your WordPress theme inside the loop. if (get_post_gallery() ){ echo ‘has gallery’; } else { echo ‘has no gallery’; } If you want to show the gallery

Continue reading →

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 →

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.