Skip to content

Instantly share code, notes, and snippets.

@NickToye
Created February 26, 2013 14:14
Show Gist options
  • Save NickToye/5038704 to your computer and use it in GitHub Desktop.
Save NickToye/5038704 to your computer and use it in GitHub Desktop.
<?php
/*
Template Name: Links Page
*/
get_header(); ?>
<div id="content" class="d-all t-all m-all">
<div id="main" role="main" class="d1-d8">
<?php while ( have_posts() ) : the_post(); ?>
<h1><?php the_title();?></h1>
<section class="intro">
<?php the_content(); ?>
</section>
<?php endwhile; // end of the loop. ?>
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<h2>Directory</h2>
<ul class="directory clearfix">
<?php
$args = array(
'post_type' => 'links');
$forsale = new WP_Query( $args );
if( $forsale->have_posts() ) {
while( $forsale->have_posts() ) {
$forsale->the_post();
?>
<li>
<dl>
<dt><a href="http://<?php the_field('link_web_address'); ?>"><?php the_title(); ?></a></dt>
<dd class="desc"><?php the_field('link_description'); ?></dd>
<dd class="tags">
</dd>
</dl>
</li>
<?php
$values = get_field('link_tag');
if($values)
{
echo '<ul>';
foreach($values as $value)
{
echo '<li>' . $value . '</li>';
}
echo '</ul>';
}
// always good to see exactly what you are working with
// var_dump($values);
?>
<?php
}
}
else {
echo 'Oh ohm no links!';
}
?>
</ul>
<? wp_reset_query(); ?>
<?php endwhile; ?>
</div><!-- #main -->
<?php get_sidebar(); ?>
</div><!-- #content -->
</div>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment