This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Name: fluidimage.js | |
* | |
* @author Pat Ramsey <[email protected]> | |
* @copyright Copyright (c) 2011, Pat Ramsey | |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License | |
* @description Part of the WP Fluid Images plugin. Replaces pixel-based width & height attributes with style attributes using percentages. | |
* | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Truncate WordPress post title | |
* @author Pat Ramsey | |
* @link | |
* | |
* @param $title, $limit | |
*/ | |
function s25_trunc_title( $limit ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$wp_roles = new WP_Roles(); | |
$names = $wp_roles->get_names(); | |
print_r($names); | |
$wp_roles->remove_role('name_of_role_to_be_removed'); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title>Dynamic text sizing</title> | |
<!--[if IE]> | |
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> | |
<![endif]--> | |
<!-- From @Beejamin - http://stackoverflow.com/users/79068/beejamin --> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript" charset="utf-8"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// filter user description to return something shorter | |
add_filter ( 'pre_user_description', 's25_short_description' ); | |
function s25_short_description($description) { | |
$max_characters = 50; | |
if ( strlen( $description ) > $max_characters ) { | |
$description = substr( $description, 0, $max_characters + 1 ); | |
$description = trim( substr( $description, 0, strrpos( $description, ' ' ) ) ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Takes a gravity form's date field & converts it to unix date/time format by populating a hidden field | |
* | |
*/ | |
add_action('gform_pre_submission','s25_format_combstartdate'); | |
function s25_format_combstartdate($form){ | |
//submission form uid is 1 | |
if($form["id"] != 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* The JW Player plugin drops shortcode into the editor. It's not filtered through WordPress's do_shortcode(). | |
* You need to use jwplayer_tag_callback(). | |
*/ | |
global $post; | |
if (get_post_meta($post->ID, '_cmb_mini_wysiwyg', true) ): | |
$myvid = get_post_meta($post->ID, '_cmb_mini_wysiwyg', true); | |
$myvid = jwplayer_tag_callback( $myvid ); | |
echo $myvid; |
OlderNewer