• Resolved crewsd

    (@crewsd)


    Hi, I’m pretty new to using WordPress and so far I LOVE IT!

    Here’s my dilemma: I have 6 or so pages that will act as different sections of my website. I have post categories with the exact same names as the pages and what I want to do is display the posts in category A when on page A. Display the posts in category B when on page B.

    This is probably a pretty simple trick, but how can I do it?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • +1 Same question

    Hi.

    Here is how I handled that aim.

    Hope that helps.
    Regards.

    <div id="content">
    <?php if (have_posts()) : the_post(); ?>
    <h1><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); // of the page ?></a></h1>
    <?php the_content(); // of the page
    endif; ?>
    
    	<?php if (is_page('21')) :	// nr of the page you want news in
    	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; // restaure pagination
    	query_posts("cat=1&paged=$paged"); // nr of the category you want selected in this page
    	$more = 0;		// "Read More" in anothe page than Archive thanks to https://www.ads-software.com/support/topic/67173?replies=16
    		 if (have_posts()) : while (have_posts()) : the_post();?>
    			<div class="entry">
    			<h3 class="entrytitle" id="post-<?php the_ID(); ?>"><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    			<div class="entrybody">
    			<p class="entrydate"><?php the_date('','<span>','</span>, '); ?>at <?php the_time(); ?> :</p>
    			<?php the_content(); ?>
    			</div>
    			</div>
    	 	<?php endwhile; endif; ?>
    		 	<div class="navigation">
    			<span class="left"><?php next_posts_link('&laquo; pr&eacute;c&eacute;dentes actus') ?></span>
    			<!--<span class="left"><a href="/archives/" title="Acc&eacute;der aux rubriques, tags et archives mensuelles">archives des actus adh&eacute;rents</a></span>-->
    			<span class="right"><?php previous_posts_link('actus plus fra&icirc;ches &raquo;') ?></span>
    			</div>
    	<?php endif; ?>
    </div>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Showing posts on pages’ is closed to new replies.