Here are some of my favorite functions.php snippets to include when starting a new website. If you want, you can use a plugin called Code Snippets and add / import / export functions that way.
If using GeneratePress theme, the functions.php might not be as popular because GP gives you customization options that you would otherwise need a functions.php snippet for… just sayin’.
Display Last Updated Date
I recommend using the WP Last Modified Info plugin.
// Add "[modified_date]" to the display
function post_modified_date() {
return get_the_modified_date();
}
add_shortcode( 'modified_date', 'post_modified_date' );
Allows SVG in the Media Library
function meow_upload_mimes( $file_types ) {
$new_filetypes = array();
$new_filetypes['svg'] = 'image/svg';
$file_types = array_merge( $file_types, $new_filetypes );
return $file_types;
}
add_action( 'upload_mimes', 'meow_upload_mimes', 10, 1 );
Disable WordPress Administration email verification prompt
add_filter( 'admin_email_check_interval', '__return_false' );
Misc Links
- https://themeisle.com/blog/wordpress-functions-php-guide/
- https://www.wpkube.com/code-snippets-wordpress/
- https://docs.generatepress.com/article/show-the-updated-post-date/
- https://www.wpglossy.com/show-last-updated-date-in-generatepress-theme/