Skip to content

Instantly share code, notes, and snippets.

@kingsidharth
Created May 12, 2012 07:23
Show Gist options
  • Save kingsidharth/2664944 to your computer and use it in GitHub Desktop.
Save kingsidharth/2664944 to your computer and use it in GitHub Desktop.
<?php
/*class TM_Loop extends thesis_custom_loop {
function home() {
thesis_loop::home();
}
}*/
//$loopty_loop = new tm_loop_home;
class TM_Loop extends thesis_custom_loop {
function home() {
echo "<div class=\"format_text\">";
#recent
echo '<div id="recent" class="post_list">';
echo '<h2>Recent Ones</h2>';
echo "<ul class=\"post_list\">";
global $post;
$args = array( 'numberposts' => 5);
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post);
echo "<li>";
$post_image = thesis_post_image_info('thumb');
echo $post_image['output'];
echo "<a class=\"title\" href=\"";
the_permalink();
echo "\">";
the_title();
echo "</a>";
echo "<div class=\"byline\"><div class=\"author\">by <span>";
echo get_the_author_meta('display_name');
echo "</span></div><div class=\"date\">&nbsp;on <span>";
the_time('F j, Y');
echo "</span></div></div>";
echo "</li>";
endforeach;
echo "</ul></div>";
echo '<div id="popular" class="post_list">';
get_mostpopular('range=all&limit=10&header="Popular Ones"&header_start="<h2>"&header_end="</h2>"&stats_comments=0&order_by="views"');
echo '</div><!-- popular -->';
# category
$categories= get_categories('hide_empty=1&orderby=count&order=desc');
echo "<div id=\"category_listing\">";
foreach ($categories as $category) {
$slug = $category->slug;
if($slug == "inspiration" || $slug == "movies" || $slug == "relations") {
echo "<div class=\"post_list category_list\" id=\"" . $category->slug . "\">";
echo "\t\t<h2>" . $category->name .
" <a href=\"/category/". $category->slug ."\">&rarr;</a></h2>";
echo "<ul>";
query_posts('category_name='. $category->slug .'&posts_per_page=3');
while (have_posts()) {
the_post();
echo "<li class=\"post_item\">";
$post_image = thesis_post_image_info('thumb');
echo $post_image['output'];
echo "<a class=\"title\" href=\"" . get_permalink() . "\">" . get_the_title() . "</a>";
echo "<div class=\"byline\"><div class=\"author\">by <span>";
echo get_the_author_meta('display_name');
echo "</span></div></div>";
echo "</li>\n";
} #end loop
wp_reset_query();
echo "</ul>";
echo "</div><!-- category_list -->";
}# end if
} #categories loop
echo "</dib><!-- category_listing -->";
echo "</div><!-- format_text -->";
} # is home
function author() { ?>
<div itemscope itemtype="http://schema.org/Person" class="author_info">
<?php if(get_query_var('author_name')) :
$curauth = get_userdatabylogin(get_query_var('author_name'));
else :
$curauth = get_userdata(get_query_var('author'));
endif;
?>
<div class="format_text author_page">
<div class="postauthor ">
<?php echo get_avatar( $curauth->ID , 120 ); ?>
<h1 itemprop="name"> <?php echo $curauth->first_name; ?> <?php echo $curauth->last_name; ?></h1>
<h2><span itemprop="jobTitle">
<?php if($curauth->user_email == 'king@kingsidharth.com') {
echo 'Founder';
} else {
echo 'Author';
} ?>
</span> at
<div class="inline" itemprop="affiliation" itemscope itemtype="http://schema.org/Organization">
<span itemprop="name">
<a href="http://thefriendz.biz" itemprop="url">the Friendz</a></span>
</div>
</h2>
<p><a href="<?php echo $curauth->url; ?>" itemprop="url">Website &rarr;</a></p>
<p itemprop="description"><?php echo $curauth->description; ?></p>
<?php
$id = $curauth->ID;
/* if(get_the_author_meta('twitter', $id)){
echo '<a href="';
the_author_meta('twitter', $id);
echo '" class="twitter-follow-button" data-show-count="false"> Follow';
the_author_meta('display_name',$id);
echo '</a>';
}*/
if(get_the_author_meta('facebook', $id)){
echo '<div class="fb-subscribe" data-href="';
the_author_meta('facebook', $id);
echo '" data-layout="button_count" data-show-faces="false" data-width="450"></div>';
} ?>
</div></div>
</div><!-- format_text -->
<?php thesis_loop::author(); ?>
<?php }
}
$loop_tf = new TM_Loop;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment