Last active
August 29, 2015 14:12
-
-
Save aijodesigns/42bcbf17f8aa8980fd7a to your computer and use it in GitHub Desktop.
WordPress Blog Archive and Single Post Snippits
This file contains 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 | |
/* | |
Template Name: Blog Archive | |
*/ | |
get_header(); ?> | |
<!-- default page layout --> | |
<div id="main" class="blog-archive"> | |
<div class="row"> | |
<div class="col-md-9 col-sm-12 col-xs-12 pull-right"> | |
<h1>News Archive</h1> | |
<?php | |
// Query up the posts | |
query_posts( array ( 'category_name' => 'news, uncategorized' ) ); | |
// Begin Loop | |
if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> | |
<div class="post"> | |
<div class="thumb left"> | |
<?php the_post_thumbnail(); ?> | |
</div> | |
<div class="post-content"> | |
<h3><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3> | |
<div class="entry"> | |
<?php the_excerpt(); ?> | |
</div> | |
</div><!-- end post content --> | |
</div><!-- end post --> | |
<?php | |
// End Loop | |
endwhile; else : ?> | |
<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p> | |
<?php endif; ?> | |
<div class="nav-previous alignleft"><?php next_posts_link( 'Older posts' ); ?></div> | |
<div class="nav-next alignright"><?php previous_posts_link( 'Newer posts' ); ?></div> | |
</div> | |
<?php get_sidebar(); ?> | |
</div> | |
</div><!-- #main --> | |
<?php get_footer(); ?> |
This file contains 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 | |
/** | |
* Single Page layout | for blog articles and posts | |
*/ | |
get_header(); ?> | |
<div id="main"> | |
<div class="row"> | |
<div class="col-md-9 col-sm-12 col-xs-12 pull-right"> | |
<?php | |
// Run the page loop to output the page content. | |
if ( have_posts() ) while ( have_posts() ) : the_post(); ?> | |
<?php if ( ! is_front_page() ) { ?> | |
<h2 class="entry-title"><?php the_title(); ?></h2> | |
<p class="small">Posted on <?php the_date(); ?></p> | |
<?php } ?> | |
<section class="entry-content"> | |
<?php the_content(); ?> | |
</section><!-- .entry-content --> | |
<?php endwhile; ?> | |
<h4><a style="clear:both;float: right;" href="<?php echo home_url(); ?>/blog/">« Back to Archive</a></h4> | |
</div><!-- end column--> | |
<?php get_sidebar(); ?> | |
</div><!-- end row --> | |
</div><!-- #main --> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment