Skip to content

Instantly share code, notes, and snippets.

View gregrickaby's full-sized avatar
:octocat:

Greg Rickaby gregrickaby

:octocat:
View GitHub Profile
@gregrickaby
gregrickaby / output-buffer-correct.php
Last active September 14, 2020 09:22
Output Buffer Example
<?php
/**
* Create the hero markup based on arguments.
*
* @param array $args The hero arguments
* @return string The hero markup
* @author Greg Rickaby
*/
function wds_client_get_hero( $args = array() ) {
@gregrickaby
gregrickaby / functions.php
Created June 9, 2016 18:02
Filter a custom post type after it's been registered
<?php
/**
* Filter the Products CPT to register more options.
*
* @param $args array The original CPT args.
* @param $post_type string The CPT slug.
*
* @return array
*/
@gregrickaby
gregrickaby / wordpress-custom-archive-title.php
Created April 12, 2016 15:21
Customize the WordPress Archive Title
<?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.
@gregrickaby
gregrickaby / wordpress-get-category-id-wp-query.php
Last active November 26, 2018 01:42
WordPress get category ID
<?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.
@gregrickaby
gregrickaby / 1cli-cheatsheet.md
Last active October 19, 2017 17:40
Greg's CLI Stuff
@gregrickaby
gregrickaby / jsClass.jQuery.js
Created January 11, 2016 17:15 — forked from aubreypwd/jsClass.jQuery.js
How to create a Js application as a jQuery plugin
( 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 January 11, 2016 16:07
Creating a global Js Object
// 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 December 2, 2015 17:49
WDS Javascript Back To Top
/**
* 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 October 21, 2019 02:33
Social Sharing with Javascript Pop-up
<?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() ) );

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