The majority of the site I am developing will use page templates (CMS) for each section of the main site however with News and Press Release items they will be posts rather than pages. I created a new page template for "News" and have a custom query that calls my news items and displays them with pagination. I did the same for my Press Releases section (formatted results are different). I would prefer to minimize the number of templates and would like to combine the 2 aforementioned onto a single page but am having difficulty having the template recognize "where I am" or "which was called" because I am using permalinks (ex: http://mysite.com/news-events/press-releases.html/). Is there a disconnect between "pages" and "blog posts" that will limit the ability for me to display content based on which link I click in my site navigation? Here is a code snippet of the news page:
<?php $name = 'Press Releases'; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args=array( 'category_name' => $name, 'paged' => $paged, 'posts_per_page' => 2, ); $temp = $wp_query; // assign original query to temp variable for later use $wp_query = null; $wp_query = new wp_query(); $wp_query->query($args); ?> <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?> <div> <li><p><h3> <a href='<?php the_permalink() ?>' rel="bookmark" title='Permanent Link to <?php the_title_attribute(); ?>'><?php the_title(); ?></a></h3></p> <p><?php echo get_post_meta($post->ID, 'Location', $single=true) ?> - <?php echo get_post_meta($post->ID, 'Summary', $single=true) ?></p></li> </div> <?php endwhile;?>
Thanks in advance for your responses.