Site logo

Archived topic

Category pages

1 reply · Started by Wendy Peck on June 7, 2016

Viewing posts 1–2 of 2

Hi -- I am having trouble with getting pages to display properly with Generate Press. I love this theme, and have used it over a dozen times, so I am pretty sure it is not the theme, but I still need help with the code. I am a designer who usually does OK reading and cutting and pasting php, but this one has me stumped. I have successfully used this in other templates.

The template I have here displays intro text (the content of this page) plus the excerpt for any posts with the category that matches the title of the page. It's working, but is also adding another entry above the comments. I am not sure where that is coming from, but it's no doubt something from the loop I am just not getting.

get_header(); ?>

	<div id="primary" <?php generate_content_class();?>>
		<main id="main" <?php generate_main_class(); ?>>
			<?php do_action('generate_before_main_content'); ?>
			<?php while ( have_posts() ) : the_post(); ?>

				<?php get_template_part( 'content', 'page' ); ?>

<?php query_posts('category_name='.get_the_title().'&post_status=publish,future');?>
	<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
	<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
	<p><?php the_excerpt(); ?></p>
	<?php endwhile; else: endif; ?>

				<?php
				// If comments are open or we have at least one comment, load up the comment template
				if ( comments_open() || '0' != get_comments_number() ) : ?>
					<div class="comments-area">
						<?php comments_template(); ?>
					</div>
				<?php endif; ?>

			<?php endwhile; // end of the loop. ?>
		</main><!-- #main -->
	</div><!-- #primary -->

<?php 
	do_action('generate_sidebars');
	get_footer();

If anyone can spot the problem, I would be eternally thankful.

And if you can give me a hint as to what I would need to change to do exactly the same thing with custom posts and custom categories for each post, that would get you my undying devotion (for quite a while). :)

This archived topic is closed to new replies.