Skip to content

Instantly share code, notes, and snippets.

@Matslom
Last active August 29, 2015 14:24
Show Gist options
  • Save Matslom/48b4d426c8a2ba27a15a to your computer and use it in GitHub Desktop.
Save Matslom/48b4d426c8a2ba27a15a to your computer and use it in GitHub Desktop.
<?php
/**
* Custom slider and the featured posts for the theme.
*/
if ( !function_exists( 'awaken_featured_posts' ) ) :
function awaken_featured_posts() {
global $awaken_options;
$category = (isset($awaken_options['slider-category'])) ? $awaken_options['slider-category'] : '';
); ?>
<div class="awaken-featured-container">
<div class="awaken-featured-posts">
<?php
$fposts_category = (isset($awaken_options['fposts-category'])) ? $awaken_options['fposts-category'] : '';
$fposts = new WP_Query( array(
'posts_per_page' => 3,
'cat' => $fposts_category,
'ignore_sticky_posts' => 1
));
$i = 0;
while( $fposts->have_posts() ) : $fposts->the_post();
$i++;
if($i == 1)
{?>
tutaj je duży post
<div class="afp">
<figure class="afp-thumbnail">
<?php if ( has_post_thumbnail() ) { ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail( 'featured', array('title' => get_the_title()) ); ?></a>
<?php } else { ?>
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><img src="<?php echo get_template_directory_uri(); ?>/images/thumbnail-default.jpg" alt="<?php the_title(); ?>" /></a>
<?php } ?>
</figure>
<div class="afp-title">
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
</div>
</div>
<?php }
else
{ ?>
tutaj je mały post
<div class="afp">
<figure class="afp-thumbnail">
<?php if ( has_post_thumbnail() ) { ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail( 'featured', array('title' => get_the_title()) ); ?></a>
<?php } else { ?>
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><img src="<?php echo get_template_directory_uri(); ?>/images/thumbnail-default.jpg" alt="<?php the_title(); ?>" /></a>
<?php } ?>
</figure>
<div class="afp-title">
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
</div>
</div>
<?php }
endwhile; ?>
</div>
</div>
<?php
}
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment