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 | |
foreach( get_categories('hide_empty=1','order_by=name') as $cat ) : | |
if( !$cat->parent ) { | |
echo '<h2><a href="#">' . $cat->name . '</a></h2>'; | |
echo '<ul>'; | |
process_cat_tree( $cat->term_id ); | |
} | |
endforeach; | |
wp_reset_query(); //to reset all trouble done to the original query |
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
//=========================================================== Custom Meta Box - Video | |
$prefix = 'matterful_optionbox_'; | |
$meta_box = array( | |
'id' => 'matterful_optionbox', | |
'title' => 'Ice Brimmin’ Options', | |
'page' => 'post', | |
'context' => 'normal', | |
'priority' => 'high', | |
'fields' => array( | |
array( |
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
CONDITIONAL STATEMENTS | |
====================== | |
is_home() .............................................When the user is on the blog home page | |
is_front_page() ............................................When the user is on the home page | |
is_single() ....................................................When the single post displayed | |
is_sticky() ........................................................Check if a post is sticky | |
is_page() ...........................................................When a page is displayed | |
is_category() ....................................................When a category is displayed | |
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
<? | |
//=========================================================== SUBSCRIBER SHORTCODE | |
function subscriber_shortcode($atts, $content = null ) { | |
extract(shortcode_atts(array( | |
'page' => '', | |
'headline' => 'Subscribe for free updates', | |
'button' => 'Subscribe', | |
'quote' => '', | |
'class' => 'box_main', | |
'form_class' => 'centered_form', |
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
// [quotable]"Here's my quote."[/quotable] | |
// [quotable link="" class="" link_class=""]"Here's my quote."[/quotable] | |
// if link says 'no', use only content, no permalink | |
//=========================================================== TWEET THIS SHORTCODE | |
function quotable_shortcode( $atts, $content = null ) { | |
extract(shortcode_atts(array( | |
'class' => 'no_lede', | |
'link' => '', | |
'link_class' => '', | |
), $atts)); |
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
//=========================================================== PODLISTEN SHORTCODE | |
add_shortcode('podlisten', 'podlisten_shortcode'); | |
// example: [podlisten src="http://your-site/videos/your-audio.mp3"] | |
function podlisten_shortcode($atts, $content = null) { | |
extract(shortcode_atts(array( | |
"src" => '' | |
), $atts)); | |
return ' | |
<div class="podlisten"> |
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
//=========================================================== 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 | |
$outparts = array_slice($matches[1], 0, $psToGrab); // chop off everything after the first 2 elements |
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
//=========================================================== PODLISTEN SHORTCODE | |
add_shortcode('podlisten', 'podlisten_shortcode'); | |
// example: [podlisten src="http://your-site/videos/your-audio.mp3"] | |
function podlisten_shortcode($atts, $content = null) { | |
extract(shortcode_atts(array( | |
"src" => '' | |
), $atts)); | |
return ' | |
<hr class="big"/> |
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('a[href$="mp3"]').each(function(){ | |
var audioURL = jQuery(this).attr('href'); | |
var audioName = jQuery(this).text(); | |
jQuery(this).before('<br/>'); | |
jQuery(this).after('<br/><audio controls src="'+audioURL+'" type="audio/mpeg" preload="none"></audio><br/>'); | |
}); |
NewerOlder