Skip to content

Instantly share code, notes, and snippets.

@ramseyp
ramseyp / custom-jetpack-share.php
Last active August 29, 2015 13:56
Empty the Jetpack Sharing Label input; localize a script to feed it a custom value, wrapped in a p tag.
<?php
/**
* If the Jetpack Sharing label setting has a value, remove it.
* If that field is empty, Jetpack Sharing will not output a set of H3 tags with the label.
*
*/
function sharing_label_clear() {
if ( class_exists( 'Sharing_Service' ) ) :
@ramseyp
ramseyp / if_exists.php
Last active August 29, 2015 13:56
Check to see if something exists before you call some function / class / method in your WordPress functions.php
<?php
if ( function_exists( 'function_name' ) ) {
//... do something ...
}
if ( class_exists( 'Class_Name' ) ) {
# # BEGIN WordPres<I<IfModule mod_rewrite.cReRewriteEngine OReRewriteBase ReRewriteRule ^index\.php$ - [LReRewriteCond %{REQUEST_FILENAME} !-ReRewriteCond %{REQUEST_FILENAME} !-RewriteRule . /index.php [L]
</IfModule>
# END WordPress
s
@media only screen and (max-width: 1139px) {
.site-header .widget-area {
width: 600px;
}
.genesis-nav-menu a {
padding: 40px 7px 20px;
}
@ramseyp
ramseyp / rsync command with multiple exclusions
Created May 12, 2014 22:11
rsync while excluding multiple directories
rsync -arv --exclude="*.git" --exclude=".svn" source/ /destination/
@ramseyp
ramseyp / tmpl_child-pages.php
Created August 20, 2014 03:10
Genesis child theme custom page template that shows child pages of the current page. Heavily based on: https://gist.github.com/billerickson/3218052
<?php
/*
Template Name: Custom Loop
*/
remove_action( 'genesis_loop','genesis_do_loop' );
add_action( 'genesis_loop','my_custom_loop' );
function my_custom_loop() {
<?php
remove_action('genesis_loop', 'genesis_do_loop');
add_action('genesis_loop', 'custom_loop');
function custom_loop() {
echo '<h1 class="entry-title" itemprop="headline">'.get_the_title().'</h1>';
echo '<div class="clear"></div>';
echo '<div class="singlebio">';
@ramseyp
ramseyp / expire_posts
Created November 3, 2011 03:59
Set Posts older than 3 years from current date to draft status
<?php
/**
* Set Posts older than 3 years from current date to draft status
* @link https://gist.github.com/
* @param string
* @return string
*/
add_action( 'init', 's25_mass_expire' );
function s25_mass_expire(){
global $wpdb;
@ramseyp
ramseyp / gist:1336624
Created November 3, 2011 14:31
Change default settings for the Genesis Primary Sidebar
<?php
/**
* Change default settings for the Genesis Primary Sidebar
* @link https://gist.github.com/
* @param string
* @return string
*/
//Gets rid of the default Primary Sidebar
unregister_sidebar( 'sidebar' );
@ramseyp
ramseyp / gist:1337144
Created November 3, 2011 17:36
Modify User Profile to include an active checkbox
<?php
//Extra Author Profile Meta
add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
add_action( 'edit_user_profile', 'my_show_extra_profile_fields' );
function my_show_extra_profile_fields( $user ) { ?>
<h3>Is this an active author?</h3>
<table class="form-table">
<tr>
<td>