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; |
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 | |
/* List only child pages of a page - not grandchildren | |
*/ | |
?> | |
<ul class="clearfix"> | |
<?php wp_list_pages( array('title_li'=>'','include'=>get_post_top_ancestor_id()) ); ?> | |
<?php wp_list_pages( array('title_li'=>'','depth'=>1,'child_of'=>get_post_top_ancestor_id()) ); ?> | |
</ul> |
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 | |
/* Add a social media share box to your WordPress site. | |
If you want the email sharing, you'll need to install WP-Email: http://wordpress.org/extend/plugins/wp-email/ | |
Insert <?php s25_sharing_caring(); ?> to your template where you want the box to appear. Must be used inside the Loop. | |
Facebook Like Button code can be built here: http://developers.facebook.com/docs/reference/plugins/like/ | |
Tweet Button code: https://dev.twitter.com/docs/tweet-button | |
LinkedIn Share Button: http://developer.linkedin.com/plugins/share-plugin-generator | |
Google Plus 1: http://www.google.com/webmasters/+1/button/ |
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
jQuery(document).ready(function($){ | |
$('a.fancybox').prepend('<img class="play" src="http://yoursite.com/path/to/img.png" alt="Play Video!" />'); | |
}); |
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 | |
/* | |
Template Name: User Directory | |
Inspirations for the code: @clarklab - http://clarklab.com/posts/sort-wordpress-users-by-custom-meta-value-with-get_users/ | |
@scribu - http://scribu.net/wordpress/advanced-metadata-queries.html | |
*/ | |
remove_action('genesis_loop', 'genesis_do_loop'); |