Skip to content

Instantly share code, notes, and snippets.

Pat Ramsey ramseyp

Block or report user

Report or block ramseyp

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
@ramseyp
ramseyp / custom-jetpack-share.php
Last active Aug 29, 2015
Empty the Jetpack Sharing Label input; localize a script to feed it a custom value, wrapped in a p tag.
View custom-jetpack-share.php
<?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 Aug 29, 2015
Check to see if something exists before you call some function / class / method in your WordPress functions.php
View if_exists.php
<?php
if ( function_exists( 'function_name' ) ) {
//... do something ...
}
if ( class_exists( 'Class_Name' ) ) {
View mangled-htaccess
# # 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
View QandD.css
@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
rsync while excluding multiple directories
View rsync command with multiple exclusions
rsync -arv --exclude="*.git" --exclude=".svn" source/ /destination/
@ramseyp
ramseyp / tmpl_child-pages.php
Created Aug 20, 2014
Genesis child theme custom page template that shows child pages of the current page. Heavily based on: https://gist.github.com/billerickson/3218052
View tmpl_child-pages.php
<?php
/*
Template Name: Custom Loop
*/
remove_action( 'genesis_loop','genesis_do_loop' );
add_action( 'genesis_loop','my_custom_loop' );
function my_custom_loop() {
View test_post_meta.php
<?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 Nov 3, 2011
Set Posts older than 3 years from current date to draft status
View expire_posts
<?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 Nov 3, 2011
Change default settings for the Genesis Primary Sidebar
View gist:1336624
<?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 Nov 3, 2011
Modify User Profile to include an active checkbox
View gist:1337144
<?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>
You can’t perform that action at this time.