Skip to content

Instantly share code, notes, and snippets.

View mannieschumpert's full-sized avatar

Mannie Schumpert mannieschumpert

View GitHub Profile
@mannieschumpert
mannieschumpert / gist:6adbae86c4e82f461533
Last active August 29, 2015 14:11
WP SEO: Modify SEO Title for Custom Post Type
add_filter( 'wpseo_replacements', 'mannie_filter_seo_replacements' );
function mannie_filter_seo_replacements( $replacements ){
global $post;
if ( isset( $replacements['%%title%%'] ) && $post->post_type === 'project' )
$replacements['%%title%%'] = 'Project: ' . $replacements['%%title%%'];
return $replacements;
}
@mannieschumpert
mannieschumpert / gist:3109226
Created July 14, 2012 04:38
WordPress: Custom Taxonomy
<?php
// Create *_ taxonomy
add_action( 'init', 'create_TAXONOMYNAME' );
function create_TAXONOMYNAME() {
$labels = array(
'name' => _x( 'PLURAL', 'taxonomy general name' ),
'singular_name' => _x( 'SINGULAR', 'taxonomy singular name' ),
'search_items' => __( 'Search PLURAL' ),
'all_items' => __( 'All PLURAL' ),
'parent_item' => __( 'Parent SINGULAR' ),
@mannieschumpert
mannieschumpert / gist:3135852
Created July 18, 2012 12:13
WordPress: Get Author Bio by ID
// the number is the author ID
<?php $author = get_userdata(2); echo $author->user_description; ?>
@mannieschumpert
mannieschumpert / gist:3269678
Created August 6, 2012 03:32
"Add More Wow" via Dan Cederholm at Build 2010
/* The next time you hear "needs more wow," add this to the stylesheet.
- Dan Cederholm at Build Conference 2010 https://vimeo.com/17091905 */
*:hover {
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
-o-transform: rotate(180deg);
transform: rotate(180deg);
}
@mannieschumpert
mannieschumpert / gist:3815767
Last active October 11, 2015 06:18
WordPress Taxonomy Snippet for Sublime Text
<snippet>
<content><![CDATA[
// Create taxonomy
add_action( 'init', 'create_${1:FUNCTION}' );
function create_${1:FUNCTION}() {
\$labels = array(
'name' => _x( '${3:PLURAL}', 'taxonomy general name' ),
'singular_name' => _x( '${2:SINGULAR}', 'taxonomy singular name' ),
'search_items' => __( 'Search ${3:PLURAL}' ),
@mannieschumpert
mannieschumpert / gist:3819133
Created October 2, 2012 13:27 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@mannieschumpert
mannieschumpert / twentytwelve.sass
Last active October 13, 2015 00:08
TwentyTwelve Sass-ified
/* In making a child theme of Twenty Twelve, I didn't want to use the standard @import in the production CSS.
* Since I'm using Sass, I "Sass-ified" Twenty Twelve so that it could be imported directly into my own stylesheet.
* This way it can be minifed, and I can save an http request. Double win.
* I removed a lot of comments, because the .sass syntax is really particular about formatting.
* I preserved the line numbering just in case the files needed comparing (thus all the blank lines).
*
* (FYI, I'm enqueueing a different stylesheet in the theme files than the one that identifies the theme.)
*/
@mannieschumpert
mannieschumpert / gist:4587131
Last active December 11, 2015 10:28
Just for showing an example on sassmeister.com.
// Sass v3.2.5
// Compass v0.13.alpha.0
a
+transition(all, 0.3s)
div
@include box-sizing(border-box)
@include border-radius(4px)
@mannieschumpert
mannieschumpert / gist:4760522
Last active December 12, 2015 10:39
An example of dequeueing a parent theme (in this case TwentyTwelve) to include your own.
function replace_twentytwelve_styles() {
wp_dequeue_style( 'twentytwelve-style' );
wp_deregister_style( 'twentytwelve-style' );
wp_enqueue_style( 'my-style', get_stylesheet_directory_uri() . '/css/style.css' );
}
add_action( 'wp_enqueue_scripts', 'replace_twentytwelve_styles', 11 );
@mannieschumpert
mannieschumpert / gist:5026289
Last active December 14, 2015 04:09
Bash function for installing WordPress
wp() {
# Needs two parameters
# Parameter 1 is the account name, or install directory
# Parameter 2 will set the database password
cd ~/../home/${1}/public_html # go to install directory
wget http://wordpress.org/latest.tar.gz # get latest WordPress
tar xfz latest.tar.gz # unpack
chown -R ${1} wordpress # change all files in wordpress to be owned by user (solves a problem when installing as root)
chgrp -R ${1} wordpress # change associated group (solves a problem when installing as root)
mv wordpress/* ./ # move all files from /wordpress to the root directory