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 / remove-query-strings-from-static-resources.php
Created Sep 9, 2019
remove query strings from static content in WordPress
View remove-query-strings-from-static-resources.php
<?php
//Remove Query Strings From Static Resources
function smartwp_remove_query_strings_from_static_resources( $src ) {
if( strpos( $src, '?v=' ) ){
$src = remove_query_arg( 'v', $src );
}
if( strpos( $src, '?ver=' ) ){
$src = remove_query_arg( 'ver', $src );
}
return $src;
@someguy9
someguy9 / current-user-id-wordpress.php
Created Sep 8, 2019
Display current user ID in WordPress
View current-user-id-wordpress.php
<?php
echo 'The current logged in user ID is: '.get_current_user_id();
@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';
}
@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;
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 / 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>
@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 / 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 / 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
You can’t perform that action at this time.