Skip to content

Instantly share code, notes, and snippets.

@cosmocanuck
Created December 16, 2013 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cosmocanuck/7995256 to your computer and use it in GitHub Desktop.
Save cosmocanuck/7995256 to your computer and use it in GitHub Desktop.
"Recent Work" section of theme's homepage.
<?php if ( get_option('evolution_display_recentwork_section') == 'on' ) { ?>
<div id="recent-work" class="clearfix">
<div id="work-info">
<h3><?php esc_html_e('Recent Work','Evolution'); ?></h3>
<p><?php echo get_option('evolution_homework_desc'); ?></p>
</div> <!-- end #work-info -->
<?php
$work_count = 0;
$recent_exlcats_work = get_option('evolution_exlcats_work');
$recent_work_args = apply_filters( 'evolution_recent_work_args', array(
'posts_per_page' => (int) get_option('evolution_posts_work_num'),
) );
if ( is_array( $recent_exlcats_work ) )
$recent_work_args['category__not_in'] = array_map( 'intval', et_generate_wpml_ids( $recent_exlcats_work, 'category' ) );
$recent_work_query = new WP_Query( $recent_work_args );
while ( $recent_work_query->have_posts() ) : $recent_work_query->the_post();
++$work_count;
$width = (int) apply_filters( 'evolution_home_work_width', 203 );
$height = (int) apply_filters( 'evolution_home_work_height', 203 );
$titletext = get_the_title();
$thumbnail = get_thumbnail($width,$height,'item-image',$titletext,$titletext,true,'Work');
$thumb = $thumbnail["thumb"];
$lightbox_title = ( $work_title = get_post_meta(get_the_ID(), 'work_title',true) ) ? $work_title : $titletext;
$work_description = ( $work_desc = get_post_meta(get_the_ID(), 'work_description',true) ) ? $work_desc : truncate_post( 50, false );
?>
<div class="r-work<?php if ( 0 == $work_count % 3 ) echo ' last'; ?>">
<?php print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, 'item-image'); ?>
<span class="overlay"></span>
<a href="<?php the_permalink(); ?>" class="more"></a>
<a href="<?php echo esc_url($thumbnail['fullpath']); ?>" class="zoom fancybox" title="<?php echo esc_attr( $lightbox_title ); ?>" rel="work_gallery"></a>
<p><?php echo esc_html( $work_description ); ?></p>
</div> <!-- end .r-work -->
<?php endwhile; wp_reset_postdata(); ?>
</div> <!-- end #recent-work -->
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment