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
@gregrickaby
gregrickaby / functions.php
Last active Aug 29, 2015
Custom RSS template for WordPress
View functions.php
<?php
add_action( 'after_setup_theme', 'my_rss_template' );
/**
* Register custom RSS template.
*/
function my_rss_template() {
add_feed( 'short', 'my_custom_rss_render' );
}
@gregrickaby
gregrickaby / sticky-cpt.php
Last active Aug 29, 2015
Make a CPT post sticky anytime it's updated
View sticky-cpt.php
<?php
add_action( 'save_post', 'child_sticky_factory', 99 );
/**
* Allow sticky posts in a CPT
*/
function child_sticky_factory() {
$post_id = get_the_ID();
$stickem = get_post_meta( $post_id, '_child_sticky', true );
View social-icons-widget.php
<?php
/*
Plugin Name: Social Icons Widget
Description: A simple widget to display social icons from Font Awesome.
Version: 1.0.0
Author: Greg Rickaby
Author URI: http://gregrickaby.com
License: GPLv2
Text Domain: textdomain
*/
@gregrickaby
gregrickaby / functions.php
Last active Aug 29, 2015
How to create an Author Box using the Gravatar API
View functions.php
<?php
// DO NOT INCLUDE OPENING PHP TAG AND PLACE INTO FUNCTIONS.PHP
/**
* Get Author's Gravatar profile data.
*/
function custom_get_gravatar_profile() {
// Get author data
$author = strtolower( trim( get_the_author_meta( 'email' ) ) );
@gregrickaby
gregrickaby / functions.php
Created Aug 4, 2014
Auto check the "Open link in a new window/tab" checkbox in WordPress
View functions.php
<?php
// DO NOT INCLUDE THE OPENING PHP TAG AND INSERT INTO FUNCTIONS.PHP
add_action( 'admin_footer', 'custom_new_link_auto_check', 9999 );
/**
* Auto check the "Open link in a new window/tab" modal
*/
function custom_new_link_auto_check() { ?>
<script type="text/javascript">
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 / 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>
@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">
View fix_msword.php
/**
* fixMSWord
*
* Replace ascii chars with utf8. Note there are ascii characters that don't
* correctly map and will be replaced by spaces.
*
* Updated 7-15-2015 by Jay Wood to encode lower end items into HTML entity counterparts.
*
* @author Robin Cafolla,Jay Wood
* @date 2013-03-22
View Disable Plugins.md

Disable Plugins

Quickly disable all plugins in WordPress.

Usage

This plugin needs to go into the wp-content/mu-plugins/ directory. Provided you have SSH access to the server where WordPress lives, you can do this:

cd $SITE_ROOT/wp-content/mu-plugins
You can’t perform that action at this time.