Skip to content

Instantly share code, notes, and snippets.

@zoerooney
Forked from anonymous/gist:0459f28ad815dfc10f13
Last active August 29, 2015 14:01
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 zoerooney/fc533260e684712e02de to your computer and use it in GitHub Desktop.
Save zoerooney/fc533260e684712e02de to your computer and use it in GitHub Desktop.
<?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 got_deros
* @since Got Deros 1.0
*/
get_header(); ?>
<div id="primary">
<div id="content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-content">
<div class="cpt-search">
<form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<input type="text" class="field" name="s" id="s" placeholder="SEARCH LISTINGS" />
<input type="hidden" name="post_type" value="phone-listing" />
<input type="submit" class="submit" name="submit" id="searchsubmit" value="<?php esc_attr_e( '&nbsp;', 'gotderos' ); ?>" />
</form>
</div>
<?php the_content(); ?>
<div class="category-list clearfix">
<?php $terms = get_terms('city-guide-category');
foreach( $terms as $term ) :
$args = array(
'post_type' => 'city-guide',
'tax_query' => array(
array(
'taxonomy' => 'city-guide-category',
'field' => 'slug',
'terms' => $term->slug,
),
),
);
$loop = new WP_Query($args);
if( $loop->have_posts() ):?>
<a href="<?php echo get_term_link( $term->slug, 'city-guide-category' ); ?>">
<h3><?php echo $term->name; ?></h3>
</a>
<?php while( $loop->have_posts() ) : $loop->the_post(); ?>
<a href="<?php echo get_term_link( $term->slug, 'city-guide-category' ); ?>#<?php echo sanitize_title_with_dashes( get_the_title() ); ?>">
<h4>
<?php the_title(); ?>
</h4>
</a>
<?php endwhile;
endif; wp_reset_postdata(); ?>
<?php endforeach; ?>
</div><!--cat-list-->
<a href="/apo-friendly-merchants/" class="apo-friendly">+ <span class="red">APO FRIENDLY MERCHANTS</span></a>
</div><!-- .entry-content -->
</article><!-- #post-<?php the_ID(); ?>-->
<?php endwhile; // end of the loop. ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment