Skip to content

Instantly share code, notes, and snippets.

Working from home

Andy Feliciotti someguy9

Working from home
View GitHub Profile
View criticalcss-bookmarklet-devtool-snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles =;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
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
if ( is_user_logged_in() ) {
echo 'Welcome, logged in user. <a href="'.wp_logout_url().'">Click here to logout</a>.';
echo 'Please login by <a href="'.wp_login_url().'">clicking here</a>.'
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
if( current_user_can('administrator') ) {
echo 'This will display for WordPress admins only.';
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 / disable-emojis-wordpress.php
Last active Jul 1, 2019
Disable emojis in WordPress
View disable-emojis-wordpress.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 / wordpress-iframe-shortcode
Last active Jul 1, 2019
iFrame shortcode example for WordPress
View wordpress-iframe-shortcode
[iframe src="" width="100%" height="500"]
View responsive-css-embed-html.html
<div class="responsive-embed-container"><iframe width="560" height="315" frameborder="0" allowfullscreen src=""></iframe></div>
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 {
max-width: 100% !important;
.responsive-embed-container iframe, .responsive-embed-container object, .responsive-embed-container embed {
someguy9 / shortcode-exists.php
Created Aug 8, 2019
Check if a shortcode already exists in WordPress
View shortcode-exists.php
if ( shortcode_exists( 'gallery' ) ) {
echo 'The [gallery] shortcode already exists';
if ( !shortcode_exists( 'gallery' ) ) {
echo 'The [gallery] shortcode does not exist';
someguy9 / current-user-id-wordpress.php
Created Sep 8, 2019
Display current user ID in WordPress
View current-user-id-wordpress.php
echo 'The current logged in user ID is: '.get_current_user_id();
You can’t perform that action at this time.