Skip to content

Instantly share code, notes, and snippets.

<?php
//=========================================================== Grab first paragraph (two if first is not long enough)
function get_first_two_paragraphs(){
global $post;
$str = wpautop( get_the_content() );
$psToGrab = 2; // number of paragraphs to get
$maxFirstParaLength = 200; // character max in first paragraph
$matches = array(); // matching elements will go here
$pattern = '%<p[^>]*>(.*?)</p>%i'; // match what's between all <p> tags
preg_match_all($pattern, $str, $matches); // do the regex match
@chasereeves
chasereeves / gist:2a36fd3cf02844eef47f
Created March 4, 2015 19:59
Fizzle Soundcloud Shortcode
// [podsc url="069-work-for-yourself-or-for" hrtop="" hrbottom="" btn_top=""]
function podsc($atts) {
extract(shortcode_atts(array(
"url" => '',
"hrtop" => 'true',
"hrbottom" => 'true',
"btn_top" => ''
), $atts));
// remove intro bits of URL if it's in the shortcode
@chasereeves
chasereeves / Thesis - Move Nav
Created February 2, 2011 04:37
Thesis move nav
//=========================================================== Move Nav
remove_action('thesis_hook_before_header','thesis_nav_menu');
add_action('thesis_hook_after_header','thesis_nav_menu');
@chasereeves
chasereeves / Basic custom.css
Created February 2, 2011 05:10
All the basic thesis CSS
/* LAYOUT SIDEBAR HEADER/NAV FEATURE BOX TYPOGRAPHY/LINKS FOOTER GLOBAL*/
/* =========================== LAYOUT =========================== */
.custom #header {
}
.custom .full_width .page {
}
.custom #content {
}
.custom #sidebars {
}
@chasereeves
chasereeves / Thesis - Custom Meta Stuff
Created February 2, 2011 04:36
Thesis custom meta stuff
//=========================================================== Custom Meta Stuff
function custom_meta_stuff() { ?>
<?php } add_action('wp_head', 'custom_meta_stuff');
@chasereeves
chasereeves / Thesis - Custom Header
Created February 2, 2011 04:36
Thesis custom header
//=========================================================== Custom Header
remove_action('thesis_hook_header', 'thesis_default_header');
function custom_header() { ?>
<?php } add_action('thesis_hook_header', 'custom_header');
@chasereeves
chasereeves / Thesis - Add Category to Byline
Created February 2, 2011 04:39
Thesis add category to byline
//========================================================== Byline, Category on same line
function add_to_byline() {
if (!is_page()) { echo ' in <span>' . get_the_category_list(',') . '</span>'; }
} add_action('thesis_hook_byline_item', 'add_to_byline', '99');
@chasereeves
chasereeves / Thesis - Custom Footer Scripts
Created February 2, 2011 04:41
Thesis custom footer scripts hook with google analytics, jquery, etc.
@chasereeves
chasereeves / Basic custom_functions.php
Created February 2, 2011 04:55
all the basic thesis hooks.
<?php
// thesis_nav_menu();
// thesis_content_column();
//=========================================================== CUSTOM META STUFF
function custom_meta_stuff() { ?>
<?php } add_action('wp_head', 'custom_meta_stuff');
//=========================================================== CUSTOM HEADER
remove_action('thesis_hook_header', 'thesis_default_header');
@chasereeves
chasereeves / Thesis - Custom Footer
Created February 2, 2011 04:40
Thesis custom footer