Skip to content

Instantly share code, notes, and snippets.

Avatar

Mark Jaquith markjaquith

View GitHub Profile
@markjaquith
markjaquith / home-page-redirect.php
Last active Feb 20, 2017 — forked from davidzack/gist:194f37444c9d68630308ee416381ef61
If user is logged in, and on the front page, redirect to /?firstName=FIRST&lastName=LAST
View home-page-redirect.php
<?php
function home_page_first_last_name_redirect() {
if ( is_front_page() && is_user_logged_in() && ! isset( $_GET['firstName'] ) ) {
$user = wp_get_current_user();
$url = add_query_arg( array(
'firstName' => $user->first_name,
'lastName' => $user->last_name,
));
wp_redirect( $url );
@markjaquith
markjaquith / 0_reuse_code.js
Last active Sep 7, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View genesis-front-page-manager-functions.php
<?php
/**
* Genesis Front Page Manager
*
* @package Genesis_Front_Page_Manager
* @author Brad Potter
* @license GPL-2.0+
* @link http://www.bradpotter.com/plugins/genesis-front-page-manager
* @copyright Copyright (c) 2014, Brad Potter
*/
View remove-menu-items.php
<?php
/*
Plugin Name: SQMS Remove Menu Items
Plugin URI: http://sequoiaims.com
Description: Plugin for Sequoia MasterSite to remove menu items based on current user level
Author: Ryan Olson
Author URI: http://thatryan.com
Version: 1.1
*/
View Remove Tagline From Specific Page Minimum Pro Theme Genesis.php
//* Add the site tagline section
add_action( 'genesis_after_header', 'minimum_site_tagline');
function minimum_site_tagline() {
if ( !is_page( 'ಠ_ಠ' ) )
printf( '<div %s>', genesis_attr( 'site-tagline' ) );
genesis_structural_wrap( 'site-tagline' );
printf( '<div %s>', genesis_attr( 'site-tagline-left' ) );
printf( '<p %s>%s</p>', genesis_attr( 'site-description' ), esc_html( get_bloginfo( 'description' ) ) );
echo '</div>';
View gist:5393829
<?php
add_filter( 'template_include', 'ja_template_check' );
function ja_template_check( $template ) {
if ( is_category() ){
// Get category information
$cat = get_query_var( 'cat' );
$category_info = get_category( $cat );
// News sub-categories, where 7 is the ID for News
@markjaquith
markjaquith / plugin-deploy.sh
Created Nov 16, 2012 — forked from scribu/plugin-deploy.sh
Plugin deploy script
View plugin-deploy.sh
#!/bin/bash
# args
MSG=${1-'deploy from git'}
BRANCH=${2-'trunk'}
# paths
SRC_DIR=$(git rev-parse --show-toplevel)
DIR_NAME=$(basename $SRC_DIR)
DEST_DIR=~/svn/wp-plugins/$DIR_NAME/$BRANCH
@markjaquith
markjaquith / lists.php
Created Dec 7, 2011 — forked from trepmal/lists.php
WordPress: Testing bulleted and numbered lists
View lists.php
<?php
//Plugin Name: Bulleted Lists
new Bulleted_List();
class Bulleted_List {
function __construct() {
View git-svn-diff.sh
#!/bin/bash
#
# git-svn-diff originally by (http://mojodna.net/2009/02/24/my-work-git-workflow.html)
# modified by mike@mikepearce.net
# modified by aconway@[redacted] - handle diffs that introduce new files
# modified by t.broyer@ltgt.net - fixes diffs that introduce new files
# modified by m@rkj.me - fix sed syntax issue in OS X
#
# Generate an SVN-compatible diff against the tip of the tracking branch
You can’t perform that action at this time.