WordPress.org

Ready to get started?Download WordPress

Forums

Adding Category Specific Posts to a Page (4 posts)

  1. whobutsb
    Member
    Posted 6 years ago #

    Hello all, I'm a Teaching Assistant at URI, and I'm trying to setup a website for a professor, using WordPress as the backbone. My plan is to organize all his classes in to one webpage with links to each individual class page which will contain a Blog for the class, syllabus, and schedule.

    On my Class blog page I'am trying to format my page.php page to identify the page the user is currently on and to display specific blog posts based on that category.
    Here is the code I'm working with:

    <?php
    	if(is_page('COM520- Media and Emotions'))
    		{
    			 if (have_posts(in_category('2'))) : ?>
    		<?php while (have_posts()) : the_post(); ?>
    			<div class="post" id="post-<?php the_ID(); ?>">
    
    				<h1><?php the_title(); ?></h1>
    
    				<div class="post_body">
    
    					<?php the_content('Read the rest of this entry &raquo;'); ?>
    
    				</div>
    
    			</div>
    
    		<?php endwhile; ?>
    
    	<?php else : ?>
    
    			<h1>Not Found</h1>
    
    			<p>Sorry, but you are looking for something that isn't here.</p>
    
    	<?php endif;
    		}

    So Its saying if the page is COM520 display category '2' posts. But its not displaying them. Where do I need to put the category identifier in the code?

  2. moshu
    Member
    Posted 6 years ago #

    Wrong approach. Don't mix Pages and posts. Pages are NOT meant to display multiple content.

  3. whobutsb
    Member
    Posted 6 years ago #

    So how would I go about arranging Categories to also include the static class schedules and syllabus pages?

  4. moshu
    Member
    Posted 6 years ago #

    You can use the custom Category_Templates

Topic Closed

This topic has been closed to new replies.

About this Topic