Created
February 18, 2014 21:06
-
-
Save dompascal/9080090 to your computer and use it in GitHub Desktop.
WP - Page template with conditional loop for the home page displaying posts assigned to the home-page category.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The template for displaying all pages. | |
* | |
* This is the template that displays all pages by default. | |
* Please note that this is the wordpress construct of pages | |
* and that other 'pages' on your wordpress site will use a | |
* different template. | |
* | |
* @package WordPress | |
* @subpackage Boilerplate | |
* @since Boilerplate 1.0 | |
*/ | |
get_header(); ?> | |
<?php if (is_page('home')) { ?> | |
<?php $my_query = new WP_Query('category_name=home-page&showposts=-1'); ?> | |
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?> | |
<article class="thumb"> | |
<a href="<?php the_permalink(); ?>"> | |
<header><?php the_title(); ?></header> | |
<p class="experct"><?php the_excerpt(); ?></p> | |
</a> | |
</article> | |
<?php } else { ?> | |
<article> | |
<header><?php the_title(); ?></header> | |
<p class="experct"><?php the_excerpt(); ?></p> | |
</article> | |
<?php } ?> | |
<?php endwhile; ?> | |
<?php get_sidebar(); ?> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment