Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Andy Feliciotti someguy9

🏠
Working from home
Block or report user

Report or block someguy9

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@someguy9
someguy9 / enable-shortcodes-in-text-widgets.php
Created Mar 17, 2020
Enable shortcodes in text widgets (WordPress)
View enable-shortcodes-in-text-widgets.php
<?php
//Enable shortcodes in text widgets
add_filter('widget_text', 'do_shortcode');
@someguy9
someguy9 / add-admin-user-wordpress.php
Created Mar 17, 2020
Create an admin user in WordPress
View add-admin-user-wordpress.php
<?php
//Create an admin user
function smartwp_create_admin_user(){
$username = 'yourusername';
$password = '2JyAEQJ9B9Jf5T8a';
$email = 'change@me.com';
//This will ensure it only tries to create the user once (based on email/username)
if ( !username_exists( $username ) && !email_exists( $email ) ) {
$userid = wp_create_user( $username, $password, $email );
$user = new WP_User( $userid );
@someguy9
someguy9 / change-excerpt-length-wordpress.php
Created Mar 17, 2020
Change the default excerpt length in WordPress (default is 55 words)
View change-excerpt-length-wordpress.php
<?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);
View change-read-more-button-wordpress.php
<?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');
View disable-admin-bar-wordpress.php
<?php
//Disable WordPress admin bar for all logged in users
add_filter('show_admin_bar', '__return_false');
@someguy9
someguy9 / get-wordpress-version-number.php
Created Mar 16, 2020
Displays the WordPress version number
View get-wordpress-version-number.php
<?php
//Display the WordPress version number
echo get_bloginfo( 'version' );
View enable-post-thumbnails-wordpress-functions.php
<?php
//Enable theme support for featured images
add_theme_support('post-thumbnails');
@someguy9
someguy9 / wordpress-featured-image-url.php
Created Mar 15, 2020
Return WordPress post featured image URL
View wordpress-featured-image-url.php
@someguy9
someguy9 / featured-image-wordpress.php
Created Mar 15, 2020
Display a featured image in WordPress
View featured-image-wordpress.php
@someguy9
someguy9 / disable-site-admin-email-verification-screen.php
Created Mar 12, 2020
Disable the WordPress site admin email verification screen
View disable-site-admin-email-verification-screen.php
<?php
//Disable the WordPress site admin email verification screen
add_filter( 'admin_email_check_interval', '__return_false' );
You can’t perform that action at this time.