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 / wordpress-custom-archive-title.php
Created Apr 12, 2016
Customize the WordPress Archive Title
View wordpress-custom-archive-title.php
<?php
/**
* Remove archive title prefixes.
*
* @param string $title The archive title from get_the_archive_title();
* @return string The cleaned title.
*/
function grd_custom_archive_title( $title ) {
// Remove any HTML, words, digits, and spaces before the title.
View wordpress-get-category-id-wp-query.php
<?php
// Get the "featured" category object.
$featured_category = get_term_by( 'slug', 'featured', 'category' );
// Set the "featured" category ID.
$featured_category_ID = $featured_category->term_id;
// Get the latest three posts, ignoring the current post
// and any in the "featured" category.
View 1cli-cheatsheet.md
@gregrickaby
gregrickaby / jsClass.jQuery.js
Created Jan 11, 2016 — forked from aubreypwd/jsClass.jQuery.js
How to create a Js application as a jQuery plugin
View jsClass.jQuery.js
( function( $ ) {
// Create a jQuery Object.
$.fn.myObject = function() {
var target = this; // Store the target element in this variable (jQuery stuff).
// Our stuff.
this.object = {
/**
@gregrickaby
gregrickaby / myObject.js
Created Jan 11, 2016
Creating a global Js Object
View myObject.js
// Create an object in the global scope, pass in window, jQuery, and the global object into the anonymous function.
window.myObject = ( function( window, $, myObject ) {
// Create our object, properties, and functions.
myObject = {
window: $( window ), // Remove if you don't need it, makes your object smaller.
// Access variables using myObject.options
options {
@gregrickaby
gregrickaby / wds-back-to-top.js
Created Dec 2, 2015
WDS Javascript Back To Top
View wds-back-to-top.js
/**
* Back To Top.
*/
window.Back_To_Top = {};
( function( window, $, that ) {
// Private variables.
var minWidth = 768;
var minHeight = 200;
@gregrickaby
gregrickaby / social-sharing-with-javascript-popup.php
Last active Apr 3, 2016
Social Sharing with Javascript Pop-up
View social-sharing-with-javascript-popup.php
<?php
/**
* Social sharing links.
*/
function wds_client_get_social_share_links( ) {
$facebook_url = 'https://www.facebook.com/sharer/sharer.php?u=' . rawurlencode ( get_the_permalink() );
$twitter_url = 'https://twitter.com/intent/tweet?text=?text=' . urlencode( html_entity_decode( get_the_title() ) ) . '&amp;url=' . rawurlencode ( get_the_permalink() );
$linkedin_url = 'https://www.linkedin.com/shareArticle?mini=true&amp;url=' . rawurlencode ( get_the_permalink() ) . '&amp;title=' . urlencode( html_entity_decode( get_the_title() ) );
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
@gregrickaby
gregrickaby / wdsjQuery.js
Last active May 15, 2018
WDS Javascript Style
View wdsjQuery.js
/**
* file: wdsjQuery.js
*
* Handle Foo things for the foo theme.
*/
window.wdsFoo = {};
( function( window, $, app ) {
// Private variable.
var fooVariable = 'foo';
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
You can’t perform that action at this time.