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
//=========================================================== REMOVE THESIS COMMENT COUNT | |
remove_action('thesis_hook_after_post', 'thesis_comments_link'); |
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
//=========================================================== Latest Posts Loop | |
function widget_latest_posts() { | |
$widget_latest_posts = new WP_Query('posts_per_page=3'); | |
while ($widget_latest_posts->have_posts()) : $widget_latest_posts->the_post(); ?> | |
<div> | |
<h4><a href="<?php the_permalink() ?>" title="<?php the_title() ?>"><?php the_title()?></a></h4> | |
<?php the_excerpt() ?> | |
<p class="widget_latest_posts_meta">Posted on <a href="<?php the_permalink() ?>" title="<?php the_title() ?>"><?php the_date() ?></a></p> | |
</div> | |
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 GOOGLE ANALYTICS | |
function custom_goog() { ?> | |
<!-- mathiasbynens.be/notes/async-analytics-snippet Change UA-XXXXX-X to be your site's ID --> | |
<script> | |
var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview']]; | |
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1; | |
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js'; | |
s.parentNode.insertBefore(g,s)}(document,'script')); | |
</script> | |
<?php } add_action('thesis_hook_before_html', 'custom_goog'); |
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 EXCERPT LENGTH & WORDS | |
function no_ellipsis($text) { | |
global $post; | |
return str_replace('[...]', '… <span class="read_more"><a href="' . get_permalink($post->ID) . '">Read More »</a></span>', $text); | |
} | |
add_filter('the_excerpt', 'no_ellipsis'); | |
function new_excerpt_length($length) { return 20; } | |
add_filter('excerpt_length', 'new_excerpt_length'); |
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
function is_has_child() { | |
global $post; | |
if ( is_page() && $post->post_parent ) | |
return true; | |
$children = get_pages('child_of='.$post->ID); | |
if( count( $children ) != 0 ) | |
return true; | |
else | |
return false; | |
} |
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 PAGE BODY CLASS TO PAGES | |
function custom_page_bodyclass($classes) { | |
// add 'no-js' to body. Javascript in custom/js/script.js removes this when JS is active | |
$classes[] = 'no-js'; | |
if ( is_page() ) { $classes[] = 'wp_page'; } | |
if ( is_single() ) { $classes[] = 'wp_post'; } | |
// is_singular is true for is_single(), is_page() or is_attachment() | |
if ( is_singular() ) { $classes[] = 'singular'; } | |
// is_has_child is true for a parent or a child page | |
if ( function_exists( 'is_has_child' ) && is_has_child() ) { $classes[] = 'is_has_child'; } |
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 | |
/* | |
* Create page sub navigation only for pages that contain and/or are children in Thesis theme. | |
* =========================================================================================== | |
*/ | |
// STEP 1: Create test for whether a page is and/or has children | |
function is_has_child() { | |
global $post; | |
if ( is_page() && $post->post_parent ) return true; // return "true" if current page has a parent |
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
function page() { | |
global $post, $thesis_design; | |
while (have_posts()) { #wp | |
the_post(); #wp | |
$post_image = thesis_post_image_info('image'); | |
thesis_hook_before_post_box(); | |
echo "\t\t\t<div class=\"post_box top\" id=\"post-" . get_the_ID() . "\">\n"; #wp | |
thesis_hook_post_box_top(); | |
thesis_headline_area(false, $post_image); |
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
//=========================================================== SIDEBAR == Resources | |
function sidebar_resources() { ?> | |
<li class="widget widget_resources"> | |
<h3>Resources</h3> | |
<ul> | |
<?php wp_list_pages('title_li=&child_of=614&sort_column=post_modified') ?> | |
</ul> | |
</li> | |
<?php } |