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 / hide-editor.php
Created Nov 12, 2012
Hide the content editor for certain pages in WordPress
View hide-editor.php
* Hide editor on specific pages.
add_action( 'admin_init', 'hide_editor' );
function hide_editor() {
// Get the Post ID.
ramseyp / exc_format_query.php
Created Jun 7, 2012
Exclude a post format from the main query in WordPRess
View exc_format_query.php
* Add a taxonomy query to pre_get_posts to remove Quote post formats from the main query
* @author Pat Ramsey
* @link
* @param array tax_query $args
* @return modified $query
ramseyp / custom_comments.php
Last active Sep 6, 2019
Different ways of customizing the WordPress comment form
View custom_comments.php
// Customized the comment form fields ( not the comment text area )
add_filter('comment_form_default_fields', 'my_comment_form_args');
// Customizes the text area - you have to do this here, rather than in comment_form_default_fields
add_filter('comment_form_field_comment', 'my_comment_form_field_comment');
// Customized the comment notes above the form fields
add_filter( 'comment_form_defaults', 'my_comment_form_defaults' );
ramseyp / filter_yoast_seo.php
Created Oct 10, 2013
Filter Yoast Meta Box Priority - returning low moves it below standard meta boxes
View filter_yoast_seo.php
// Filter Yoast Meta Priority
function move_yoast_seo_box() {
if ( defined( 'WPSEO_VERSION' ) ) :
add_filter( 'wpseo_metabox_prio', function() { return 'low'; } );
add_action('admin_init', 'move_yoast_seo_box');
ramseyp / filter-shared-data.php
Created Feb 12, 2019
filter shared counts data
View filter-shared-data.php
function shared_counts_flipboard_data_properties( $attr, $link ) {
if ( 'flipboard' === $link['type'] ) {
$attr['flip-widget'] = 'shareflip';
return $attr;
add_filter( 'shared_counts_link_data', 'shared_counts_flipboard_data_properties', 5, 2 );
ramseyp / inf-soft-form-placeholder.js
Created Oct 3, 2012
Javascript used to make Infusionsoft form labels act as placeholders
View inf-soft-form-placeholder.js
// CSS for this can be found here:
// Add classes to the labels of selects, text-inputs, email inputs and textareas
$('.infusion-form .infusion-field select').prev('label').addClass('label-select');
$('.infusion-form .infusion-field input[type="email"], .infusion-form .infusion-field input[type="text"], .infusion-form .infusion-field textarea').prev('label').addClass('label-placeholder');
$('.infusion-form .infusion-field input[type="email"], .infusion-form .infusion-field input[type="text"], .infusion-form .infusion-field textarea').focus(function(){
$(this).prev('.infusion-field .label-placeholder').hide();
ramseyp / last-word.js
Created Feb 21, 2013
Select the last word in an element & wrap it with a span tag
View last-word.js
// separate the text by spaces
var text= $(this).text().split(' ');
// drop the last word and store it in a variable
var last = text.pop();
// join the text back and if it has more than 1 word add the span tag
// to the last word
return text.join(" ") + (text.length > 0 ? ' <span class="last">'+last+'</span>' : last);
ramseyp / page_template_column.php
Created Dec 11, 2012
Add a page template column to WordPress's Pages view.
View page_template_column.php
* Add page template column to page listing. Make the Template column sortable
ramseyp / fluidimage.js
Created Nov 21, 2011
Part of the WP Fluid Images plugin. Replaces pixel-based width & height attributes with style attributes using percentages.
View fluidimage.js
* Name: fluidimage.js
* @author Pat Ramsey <>
* @copyright Copyright (c) 2011, Pat Ramsey
* @license GNU Public License
* @description Part of the WP Fluid Images plugin. Replaces pixel-based width & height attributes with style attributes using percentages.
ramseyp / lastname-firstname-user-sort.php
Created Jun 28, 2013
Sorted the return of a Wp_User_Query by both the last name value and the first name value. This way, if multiple users have the same last name, those particular users are then sorted by first name.
View lastname-firstname-user-sort.php
function s25_member_loop() {
$args = array(
'role' => 'member', // the role we're targeting
'exclude' => '1', // exclude admin
'fields' => 'all_with_meta',
'meta_key' => 'last_name', //query on the last_name key
'meta_key' => 'first_name', // also the first_name key
$membersquery = new WP_User_Query( $args );
You can’t perform that action at this time.