Thread Starter
anonymized-3854925
(@anonymized-3854925)
Quick update, the error can’t be caused by the $_GET variable, if I remove it and add the county name as a parameter in query_posts() then I still have the same problem!
Here is the code I’m using:
<?php
/**
* @package WordPress
* Template Name: Directory
*/
?>
<?php get_header(); ?>
<div id="page">
<div id="content">
<?php get_search_form(); ?>
<?php // if($_GET['county']) : ?>
<h1>Companies in <?php echo $_GET['county']; ?></h1>
<?php query_posts('post_type=company&meta_key=County&meta_value=Cheshire&orderby=title&order=ASC'); ?>
<div id="directory-result">
<?php if(have_posts()) : ?>
<?php while(have_posts()) : the_post(); ?>
<div class="divide">
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<?php the_excerpt(); ?>
<ul class="contact">
<li><?php echo_meta('Town / City'); ?></li>
<li><?php echo_meta('Telephone'); ?></li>
<li><a href="mailto:<?php echo_meta('Email'); ?>"><?php echo_meta('Email'); ?></a></li>
<li class="last"><a href="<?php echo_meta('Website'); ?>"><?php echo_meta('Website'); ?></a></li>
</ul>
</div>
<?php endwhile; ?>
<div id="paginate">
<a id="link-top" href="#top"><img src="<?php bloginfo('template_url'); ?>/image/paginate-top.gif" alt="Back to Top" /></a>
<ul>
<?php posts_nav_link(' ', '<li><img src="' . get_bloginfo('template_url') . '/image/paginate-prev.gif" alt="Previous Page" /></li>', '<li><img src="' . get_bloginfo('template_url') . '/image/paginate-next.gif" alt="Next Page" /></li>'); ?>
</ul>
</div>
<?php else : ?>
<p>There are currently no companies registered in <?php echo $_GET['county']; ?>. If you own a business in this location then <a href="<?php bloginfo('url'); ?>/wp-admin">submit to our business directory for free</a> today!</p>
<?php endif; ?>
</div>
<?php wp_reset_query(); ?>
<?php // endif; ?>
</div><!--end content-->
<?php get_sidebar(); ?>
</div><!--end page-->
<?php get_footer(); ?>
Thread Starter
anonymized-3854925
(@anonymized-3854925)
Fixed it! Just had to add
paged=' . $paged
to the end of my query_posts() parameters