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 / shortcode-exists.php
Created Aug 8, 2019
Check if a shortcode already exists in WordPress
View shortcode-exists.php
<?php
if ( shortcode_exists( 'gallery' ) ) {
echo 'The [gallery] shortcode already exists';
}
if ( !shortcode_exists( 'gallery' ) ) {
echo 'The [gallery] shortcode does not exist';
}
View responsive-css-embed-html.html
<div class="responsive-embed-container"><iframe width="560" height="315" frameborder="0" allowfullscreen src="https://www.youtube.com/embed/fd0k_hbXWcQ"></iframe></div>
@someguy9
someguy9 / responsive-embed-youtube.css
Last active Jul 1, 2019
This CSS lets you wrap an iframe with a div using the class responsive-embed-container to make it 16:9 responsive
View responsive-embed-youtube.css
.responsive-embed-container {
position:relative;
overflow:hidden;
padding-bottom:56.25%;
height:0;
max-width: 100% !important;
}
.responsive-embed-container iframe, .responsive-embed-container object, .responsive-embed-container embed {
position:absolute;
left:0;
@someguy9
someguy9 / wp-remove-gutenberg-block-library-css.php
Created Jul 1, 2019
Removed the "/wp-includes/css/dist/block-library/style.min.css" file from your WordPress site
View wp-remove-gutenberg-block-library-css.php
<?php
function smartwp_remove_wp_block_library_css(){
wp_dequeue_style( 'wp-block-library' );
}
add_action( 'wp_enqueue_scripts', 'smartwp_remove_wp_block_library_css' );
@someguy9
someguy9 / wp-check-if-user-is-admin.php
Created Jun 25, 2019
Check if a user is an admin in WordPress.
View wp-check-if-user-is-admin.php
<?php
if( current_user_can('administrator') ) {
echo 'This will display for WordPress admins only.';
};
@someguy9
someguy9 / wp-check-if-user-is-logged-in.php
Created Jun 25, 2019
Simple code using the built in WP function that checks if you a user is logged into WordPress.
View wp-check-if-user-is-logged-in.php
<?php
if ( is_user_logged_in() ) {
echo 'Welcome, logged in user. <a href="'.wp_logout_url().'">Click here to logout</a>.';
}else{
echo 'Please login by <a href="'.wp_login_url().'">clicking here</a>.'
}
@someguy9
someguy9 / disable-emojis-wordpress.php
Last active Jul 1, 2019
Disable emojis in WordPress
View disable-emojis-wordpress.php
<?php
//Disable emojis in WordPress
add_action( 'init', 'smartwp_disable_emojis' );
function smartwp_disable_emojis() {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
@someguy9
someguy9 / featured-image-wordpress-rss-feed.php
Last active Jul 1, 2019
Display Featured Image in WordPress RSS Feed
View featured-image-wordpress-rss-feed.php
@someguy9
someguy9 / wordpress-iframe-shortcode
Last active Jul 1, 2019
iFrame shortcode example for WordPress
View wordpress-iframe-shortcode
[iframe src="https://www.youtube.com/embed/fd0k_hbXWcQ" width="100%" height="500"]
View iframe-example.html
<iframe src="https://bing.com"></iframe>
You can’t perform that action at this time.