Skip to content

Instantly share code, notes, and snippets.

@woogist
Created June 17, 2014 11:43
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 woogist/70c2960929163db44c66 to your computer and use it in GitHub Desktop.
Save woogist/70c2960929163db44c66 to your computer and use it in GitHub Desktop.
mini features icon link to post custom settings specified url
<?php
/**
* Homepage Features Panel
*/
/**
* The Variables
*
* Setup default variables, overriding them if the "Theme Options" have been saved.
*/
$settings = array(
'features_area_entries' => 3,
'features_area_order' => 'DESC'
);
$settings = woo_get_dynamic_values( $settings );
$orderby = 'date';
if ( $settings['features_area_order'] == 'rand' )
$orderby = 'rand';
?>
<?php
$number_of_features = $settings['features_area_entries'];
$query_args = array(
'post_type' => 'features',
'posts_per_page' => $number_of_features,
'order' => $settings['features_area_order'],
'orderby' => $orderby
);
/* The Query. */
$the_query = new WP_Query($query_args);
$pre_count = $the_query->post_count;
/* The Loop. */
if ($the_query->have_posts()) : $count = 0; ?>
<section id="mini-features">
<div class="col-full">
<ul>
<?php
while ($the_query->have_posts()) : $the_query->the_post(); $count++;
?>
<li class="fix <?php if ( $count % 3 == 0 ) { echo 'last'; } ?>">
<?php $feature_readmore = get_post_meta( $post->ID, 'feature_readmore', true ); ?>
<?php $feature_icon = get_post_meta( $post->ID, 'feature_icon', true ); if ( $feature_icon ) { ?><div class="image"><a href="<?php if ( $feature_readmore != '' ) { echo $feature_readmore; } else { the_permalink(); } ?>"> <img src="<?php echo get_post_meta( $post->ID, 'feature_icon', true ); ?>" alt="" /> </a></div><?php } ?>
<div class="entry">
<h2><a href="<?php if ( $feature_readmore != '' ) { echo $feature_readmore; } else { the_permalink(); } ?>"><?php the_title(); ?></a></h2>
<?php $feature_excerpt = get_post_meta( $post->ID, 'feature_excerpt', true ); ?>
<p>
<?php
if ( $feature_excerpt != '' ) {
echo stripslashes( $feature_excerpt );
} else {
the_excerpt();
} ?>
</p>
</div>
</li>
<?php if ( $pre_count > 3 ) { $special = ' special'; } ?>
<?php if ( $count % 3 == 0 ) { echo '<li class="fix clear' . $special . '"></li>'; } ?>
<?php endwhile; ?>
</ul>
</div><!-- /.col-full -->
</section><!-- /#mini-features -->
<?php endif; // End If Statement ?>
<?php wp_reset_postdata(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment