Skip to content

Instantly share code, notes, and snippets.

@congthien
Created March 21, 2017 16: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 congthien/b5a12445014d4572a1ac60366e528493 to your computer and use it in GitHub Desktop.
Save congthien/b5a12445014d4572a1ac60366e528493 to your computer and use it in GitHub Desktop.
<?php /* Start loop */ ?><?php global $data; ?>
<?php if (have_posts()) : ?>
<?php $count = 0; ?>
<?php while (have_posts()) : the_post(); ?>
<?php $count++; ?>
<?php if($data['uxde_smallarticles']): ?>
<?php if ($count == 1) : ?>
<div class="grid">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="post-header">
<?php if ( has_post_thumbnail() ) : ?>
<div class="featured-image">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('grid-thumb'); ?></a>
<span class="meta-categories"><?php the_category(', '); ?></span>
</div>
<?php endif; ?>
<h2 class="post-title entry-title clearfix"><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<div class="meta-info clearfix">
<span><span class="vcard author"><span class="fn"><?php the_author_posts_link(); ?></span></span> <?php if($data['uxde_on']): ?><?php echo $data['uxde_on']; ?><?php endif; ?> <time class="updated meta-button" datetime="<?php the_time('F, jS Y'); ?>" pubdate> <?php the_time('F, jS Y'); ?></time></span>
</div>
</header>
<div class="post-content">
<p><?php echo limit_words(get_the_excerpt(), '35'); ?>...</p>
<a class="more-link" href="<?php the_permalink(); ?>"><?php if($data['uxde_readmore']): ?><?php echo $data['uxde_readmore']; ?><?php endif; ?></a>
</div>
</article>
</div>
<?php elseif ($count == 2) : ?>
<div class="grid last">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="post-header">
<?php if ( has_post_thumbnail() ) : ?>
<div class="featured-image">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('grid-thumb'); ?></a>
<span class="meta-categories"><?php the_category(', '); ?></span>
</div>
<?php endif; ?>
<h2 class="post-title entry-title clearfix"><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<div class="meta-info clearfix">
<span><span class="vcard author"><span class="fn"><?php the_author_posts_link(); ?></span></span> <?php if($data['uxde_on']): ?><?php echo $data['uxde_on']; ?><?php endif; ?> <time class="updated meta-button" datetime="<?php the_time('F, jS Y'); ?>" pubdate> <?php the_time('F, jS Y'); ?></time></span>
</div>
</header>
<div class="post-content">
<p><?php echo limit_words(get_the_excerpt(), '35'); ?>...</p>
<a class="more-link" href="<?php the_permalink(); ?>"><?php if($data['uxde_readmore']): ?><?php echo $data['uxde_readmore']; ?><?php endif; ?></a>
</div>
</article>
</div>
<?php elseif ($count == 3) : ?>
<div class="grid">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="post-header">
<?php if ( has_post_thumbnail() ) : ?>
<div class="featured-image">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('grid-thumb'); ?></a>
<span class="meta-categories"><?php the_category(', '); ?></span>
</div>
<?php endif; ?>
<h2 class="post-title entry-title clearfix"><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<div class="meta-info clearfix">
<span><span class="vcard author"><span class="fn"><?php the_author_posts_link(); ?></span></span> <?php if($data['uxde_on']): ?><?php echo $data['uxde_on']; ?><?php endif; ?> <time class="updated meta-button" datetime="<?php the_time('F, jS Y'); ?>" pubdate> <?php the_time('F, jS Y'); ?></time></span>
</div>
</header>
<div class="post-content">
<p><?php echo limit_words(get_the_excerpt(), '35'); ?>...</p>
<a class="more-link" href="<?php the_permalink(); ?>"><?php if($data['uxde_readmore']): ?><?php echo $data['uxde_readmore']; ?><?php endif; ?></a>
</div>
</article>
</div>
<?php elseif ($count == 4) : ?>
<div class="grid last">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="post-header">
<?php if ( has_post_thumbnail() ) : ?>
<div class="featured-image">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('grid-thumb'); ?></a>
<span class="meta-categories"><?php the_category(', '); ?></span>
</div>
<?php endif; ?>
<h2 class="post-title entry-title clearfix"><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<div class="meta-info clearfix">
<span><span class="vcard author"><span class="fn"><?php the_author_posts_link(); ?></span></span> <?php if($data['uxde_on']): ?><?php echo $data['uxde_on']; ?><?php endif; ?> <time class="updated meta-button" datetime="<?php the_time('F, jS Y'); ?>" pubdate> <?php the_time('F, jS Y'); ?></time></span>
</div>
</header>
<div class="post-content">
<p><?php echo limit_words(get_the_excerpt(), '35'); ?>...</p>
<a class="more-link" href="<?php the_permalink(); ?>"><?php if($data['uxde_readmore']): ?><?php echo $data['uxde_readmore']; ?><?php endif; ?></a>
</div>
</article>
</div>
<?php else : ?>
<div class="block">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="post-header">
<?php if ( has_post_thumbnail() ) : ?>
<div class="featured-image clearfix">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('block-thumb'); ?></a>
</div>
<?php endif; ?>
<div class="title-comment clearfix">
<div class="number-comment"><a href="<?php comments_link(); ?> "><?php comments_number( '0', '1', '%' ); ?></a></div>
<h2 class="post-title entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
</div>
<div class="meta-info clearfix">
<span class="vcard author"><span class="fn"><?php the_author_posts_link(); ?></span></span>
<span> <?php if($data['uxde_on']): ?><?php echo $data['uxde_on']; ?><?php endif; ?><time class="updated meta-button" datetime="<?php the_time('F, jS Y'); ?>" pubdate> <?php the_time('F, jS Y'); ?></time></span>
<span> <?php if($data['uxde_in']): ?><?php echo $data['uxde_in']; ?><?php endif; ?> <?php the_category(' '); ?></span>
</div>
</header>
<div class="post-content">
<p><?php echo limit_words(get_the_excerpt(), '55'); ?>...</p>
<a class="more-link" href="<?php the_permalink(); ?>"><?php if($data['uxde_clicktocontinue']): ?><?php echo $data['uxde_clicktocontinue']; ?><?php endif; ?></a>
</div>
</article>
</div>
<?php endif; ?>
<?php else : ?>
<?php if ($count == 1) : ?>
<div class="block no-border">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="post-header">
<?php if ( has_post_thumbnail() ) : ?>
<div class="featured-image clearfix">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('block-thumb'); ?></a>
</div>
<?php endif; ?>
<div class="title-comment clearfix">
<div class="number-comment"><a href="<?php comments_link(); ?> "><?php comments_number( '0', '1', '%' ); ?></a></div>
<h2 class="post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
</div>
<div class="meta-info clearfix">
<span><?php the_author_posts_link(); ?></span>
<span> <?php if($data['uxde_on']): ?><?php echo $data['uxde_on']; ?><?php endif; ?><time class="updated meta-button" datetime="<?php the_time('F, jS Y'); ?>" pubdate> <?php the_time('F, jS Y'); ?></time></span>
<span> <?php if($data['uxde_in']): ?><?php echo $data['uxde_in']; ?><?php endif; ?> <?php the_category(' '); ?></span>
</div>
</header>
<div class="post-content">
<p><?php echo limit_words(get_the_excerpt(), '55'); ?>...</p>
<a class="more-link" href="<?php the_permalink(); ?>"><?php if($data['uxde_clicktocontinue']): ?><?php echo $data['uxde_clicktocontinue']; ?><?php endif; ?></a>
</div>
</article>
</div>
<?php else : ?>
<div class="block">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="post-header">
<?php if ( has_post_thumbnail() ) : ?>
<div class="featured-image clearfix">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('block-thumb'); ?></a>
</div>
<?php endif; ?>
<div class="title-comment clearfix">
<div class="number-comment"><a href="<?php comments_link(); ?> "><?php comments_number( '0', '1', '%' ); ?></a></div>
<h2 class="post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
</div>
<div class="meta-info clearfix">
<span><?php the_author_posts_link(); ?></span>
<span> <?php if($data['uxde_on']): ?><?php echo $data['uxde_on']; ?><?php endif; ?><time class="updated meta-button" datetime="<?php the_time('F, jS Y'); ?>" pubdate> <?php the_time('F, jS Y'); ?></time></span>
<span> <?php if($data['uxde_in']): ?><?php echo $data['uxde_in']; ?><?php endif; ?> <?php the_category(' '); ?></span>
</div>
</header>
<div class="post-content">
<p><?php echo limit_words(get_the_excerpt(), '55'); ?>...</p>
<a class="more-link" href="<?php the_permalink(); ?>"><?php if($data['uxde_clicktocontinue']): ?><?php echo $data['uxde_clicktocontinue']; ?><?php endif; ?></a>
</div>
</article>
</div>
<?php endif; ?>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment