Skip to content

Instantly share code, notes, and snippets.

💻
<code />

Greg Rickaby gregrickaby

💻
<code />
Block or report user

Report or block gregrickaby

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
View change-yoast-seo-metabox-priority.php
<?php
/**
* Set Yoast SEO metabox priority to low.
*/
function wds_client_move_yoastseo_metabox() {
return 'low';
}
add_filter( 'wpseo_metabox_prio', 'wds_client_move_yoastseo_metabox' );
@gregrickaby
gregrickaby / remove-emoji-support.php
Created May 25, 2015
Remove WordPress Emoji Support
View remove-emoji-support.php
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below into functions.php
/**
* Remove emoji support.
*/
function grd_remove_emoji() {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
View wp-config.php
<?php // do not include leading php tag
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*/
define('WP_DEBUG', true);
@gregrickaby
gregrickaby / web.config
Last active Aug 29, 2015
IIS 8.5 WordPress Multisite Rewrite Rules
View web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="WordPress Rule 1" stopProcessing="true">
<match url="^index\.php$" ignoreCase="false" />
<action type="None" />
</rule>
<rule name="WordPress Rule 2" stopProcessing="true">
@gregrickaby
gregrickaby / example-nginx.conf
Last active May 22, 2019 — forked from pmgarman/gist:8fba357c97193633a66d
Defer the loading of images to the production server. Use either Apache or NGINX depending on your local server setup.
View example-nginx.conf
################################################################
# Example configuration file for nginx
#
# To add a new local WordPress domain to your environment, copy
# this file using a filename that matches the domain you wish to
# setup. For example - mylocaldomain.com.conf would be an ideal
# filename for http://mylocaldomain.com
#
# Once copied, you will need to modify two settings in the server
# configuration provided:
@gregrickaby
gregrickaby / .htaccess
Last active Jan 2, 2019 — forked from nickdavis/gist:10525079
Redirect local /wp-content/uploads to the development server
View .htaccess
#301 Redirect Local Images to Live
RedirectMatch 301 ^/wp-content/uploads/(.*) http://livewebsite.com/wp-content/uploads/$1
@gregrickaby
gregrickaby / echo-an-image.php
Last active Nov 26, 2018
Get a WordPress post image, no matter what. Must be used in a loop.
View echo-an-image.php
<?php
/**
* Echo an image, no matter what.
*
* @param string $size the image size you want to echo
*/
function wds_do_post_image( $size = 'thumbnail' ) {
// If featured image is present, use that
if ( has_post_thumbnail() ) {
@gregrickaby
gregrickaby / hamburger-nav.html
Created Sep 12, 2014
Über basic Hamburger Nav...seriously feel free to contribute and make this suck less.
View hamburger-nav.html
<!-- The website logo and hamburger icon -->
<div class="mobileNavWrap">
<div class="mobileLogo">
<a href="#"><img src="/some-logo.png" alt="some website" height="100" width="100" /></a>
</div>
<div id="mobileNavIcon">
&#x2261;
</div>
</div>
View recent-post-widget.php
<?php
/*
Plugin Name: Recent Posts Widget
Plugin URI: http://gregrickaby.com
Description: Display recent posts in a widget area.
Version: 1.0.0
Author: Greg Rickaby
Author URI: http://gregrickaby.com
License: GPLv2
Text Domain: textdomain
@gregrickaby
gregrickaby / .htaccess
Created Aug 31, 2014
Lock down WordPress Dashboard login with .htaccess
View .htaccess
# APACHE .HTACCESS
# This will deny all traffic (except yours) to /wp-admin (including wp-login.php)
# It will also return a 403 forbidden error.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$
RewriteCond %{REMOTE_ADDR} !^111\.222\.333\.444$
RewriteRule ^(.*)$ - [R=403,L]
You can’t perform that action at this time.