Forums

Page title as subsequent wp query category (1 post)

  1. toxicriptide
    Member
    Posted 8 months ago #

    I am trying to have a page, and then below it a query of posts tagged with a category name the same as the title of the page. I just can't get the syntax right. Any help?

    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    				<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
    			<div class="grid_3">
    			<div id="leftbar">
    			<div class="box"><span></span></div>
    			<?php dynamic_sidebar('leftbar'); ?>
    			</div>
    			</div>
    
    						<div class="grid_13">
    			<div class="box" id="singlecontent">
    			<h2 class="singletitle"><?php the_title();?></h2>
    			<?php $thetitle = the_title();?>
    			<?php print $the_title;?>
    			<?php the_content();?>
    			</div>
    			<?php endwhile; ?>
    			<?php wp_reset_query();?>
    			<?php query_posts( array ('category_name' => $thetitle));?>
    				<?php
    				/* Run the loop for the search to output the results.
    				 * If you want to overload this in a child theme then include a file
    				 * called loop-search.php and that will be used instead.
    				 */
    				 get_template_part( 'loop', 'category' );
    				?>
    			</div>
    						<div class="clear"></div>

Reply

You must log in to post.

About this Topic