Skip to content

Instantly share code, notes, and snippets.

@grappler
Last active December 29, 2015 21:49
Show Gist options
  • Select an option

  • Save grappler/7732202 to your computer and use it in GitHub Desktop.

Select an option

Save grappler/7732202 to your computer and use it in GitHub Desktop.
<?php
/*
* Template Name: News
*/
?>
<?php get_header(); ?>
<div class="security-banner">
<div class="wrapper">
<h2>Vacant Property In The Media</h2>
<p class="breadcrumb risk-breadcrumb"><a href="#"> Home</a> >> <a href="#">Need Security?</a> >> <a
href="#">Vacant Property In The Media</a></p>
</div>
</div>
<div class="main-container">
<div class="wrapper clearfix">
<div class="column-one">
<div class="right-side news">
<?php
$args = array(
'type' => 'post',
//'include' => '36' // You add the parent category id here to restrict the number of categories
);
$categories = get_categories( $args );
foreach ( $categories as $category ) { ?>
<span class="parent-categories"><?php echo $category->name; ?></span>
<?php
$args = array(
'child_of' => $category->cat_ID
);
$child_categories = get_categories( $args );
foreach ( $child_categories as $child_category ) { ?>
<span class="child-categories"><?php echo $child_category->name; ?></span>
<?php
// WP_Query arguments
$args = array (
'post_type' => 'post',
'post_status' => 'publish',
'cat' => $child_category->cat_ID,
);
// The Query
$query = new WP_Query( $args );
// The Loop
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article">
<div class="post-image">
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail(
'thumbnail',
array(
'class' => 'blog-thumb'
)
);
} ?>
</div>
<div class="blog-entry">
<h3 class="post-title"><a href="#"><?php the_title(); ?></a></h3>
<div id="post-content">
<?php the_content( __( 'Continue Reading', 'site5framework' ) ); ?>
</div>
</div>
</article>
<?php
}
} else {
// no posts found
}
// Restore original Post Data
wp_reset_postdata();
}
} ?>
</div>
</div>
<!-- end #column-one -->
<div class="column-two-post">
<div id="right-box1">
<h2>Save With Oaksure</h2>
<p>As much as 90% on business rates for the duration the building is vacant.</p>
<p>More than 80% compared to ordinary security.</p>
<a href="#">Learn More ></a>
</div>
<div id="button-container2">
<input class="home-button2" type="submit" value="Contact Oaksure">
</div>
</div>
</div>
</div>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment