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
//Deepest Level Category | |
function get_deep_child_category( $categories ) | |
{ | |
$maxId = 0; | |
$maxKey = 0; | |
foreach ( $categories as $key => $value ) | |
{ | |
if ( $value->parent > $maxId ) | |
{ | |
$maxId = $value->term_id; |
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
// Add Best Albums to Main Query | |
add_action( 'pre_get_posts', 'add_my_post_types_to_query' ); | |
function add_my_post_types_to_query( $query ) { | |
if ( (is_home() && $query->is_main_query() && !is_admin()) || (is_category() && $query->is_main_query() && !is_admin()) || (is_tag() && $query->is_main_query() && !is_admin()) ) | |
$query->set( 'post_type', array( 'post', 'best_albums' ) ); | |
return $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
//Ingore Sticky Posts | |
// this is key! | |
add_action('pre_get_posts', 'wpse74620_ignore_sticky'); | |
// the function that does the work | |
function wpse74620_ignore_sticky($query) | |
{ | |
// sure we're were we want to be. | |
if (is_home() && $query->is_main_query()) | |
$query->set('ignore_sticky_posts', true); | |
} |
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
//Dollarfy Function | |
function dollarfy ($num,$dec="2") { | |
$format="%.$dec" . "f"; | |
$number=sprintf($format,$num); | |
$str=strtok($number,"."); | |
$dc=strtok("."); | |
$str=commafy($str); | |
$return="\$$str"; | |
if ($dec!=0){ |
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 bloginfo('template_url'); ?> |
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 | |
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); | |
echo $term->name; | |
?> |
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 echo do_shortcode( '[contact-form 1 "Contact form 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
<form method="get" id="searchform" action="<?php bloginfo('home'); ?>/"> | |
<input type="text" value="<?php echo wp_specialchars($s, 1); ?>" name="s" id="s" /> | |
<input type="hidden" name="cat" value="22" /> | |
<input type="submit" id="searchsubmit" value="Search" /> | |
</form> |