Skip to content

Instantly share code, notes, and snippets.

View someguy9's full-sized avatar
🏠
Working from home

Andy Feliciotti someguy9

🏠
Working from home
View GitHub Profile
@someguy9
someguy9 / disable-site-admin-email-verification-screen.php
Created March 12, 2020 13:13
Disable the WordPress site admin email verification screen
<?php
//Disable the WordPress site admin email verification screen
add_filter( 'admin_email_check_interval', '__return_false' );
@someguy9
someguy9 / featured-image-wordpress.php
Created March 15, 2020 21:18
Display a featured image in WordPress
@someguy9
someguy9 / get-wordpress-version-number.php
Created March 16, 2020 18:46
Displays the WordPress version number
<?php
//Display the WordPress version number
echo get_bloginfo( 'version' );
<?php
//Enable theme support for featured images
add_theme_support('post-thumbnails');
@someguy9
someguy9 / disable-admin-bar-wordpress.php
Created March 16, 2020 21:39
Disable WordPress admin bar
<?php
//Disable WordPress admin bar for all logged in users
add_filter('show_admin_bar', '__return_false');
<?php
// Changing excerpt more
function smartwp_change_excerpt_more_text( $more ){
global $post;
return '&hellip; <a class="read-more" href="'.get_permalink($post->ID).'" title="'.esc_attr(get_the_title($post->ID)).'">'.'Read More &raquo;'.'</a>';
}
add_filter('excerpt_more', 'smartwp_change_excerpt_more_text');
@someguy9
someguy9 / change-excerpt-length-wordpress.php
Created March 17, 2020 12:27
Change the default excerpt length in WordPress (default is 55 words)
<?php
//Change the default excerpt length in WordPress (default is 55 words)
function smartwp_change_excerpt_length( $length ) {
return 24;
}
add_filter( 'excerpt_length', 'smartwp_change_excerpt_length', 9999);
@someguy9
someguy9 / enable-shortcodes-in-text-widgets.php
Created March 17, 2020 12:38
Enable shortcodes in text widgets (WordPress)
<?php
//Enable shortcodes in text widgets
add_filter('widget_text', 'do_shortcode');
@someguy9
someguy9 / enable-svg-upload.php
Created March 17, 2020 12:44
Enable SVG upload in WordPress
<?php
//Enable SVG upload
function smartwp_enable_svg_upload( $mimes ) {
//Only allow SVG upload by admins
if ( !current_user_can( 'administrator' ) ) {
return $mimes;
}
$mimes['svg'] = 'image/svg+xml';
$mimes['svgz'] = 'image/svg+xml';
@someguy9
someguy9 / disable-xml-rpc.php
Created March 17, 2020 12:46
Disable XML-RPC in WordPress
<?php
//Disable XML-RPC
add_filter('xmlrpc_enabled', '__return_false');