Support » Themes and Templates » Page template that has page content & lists posts

  • Resolved Ash

    (@ashbryant)


    Hi,

    I thought this would be easy, however I think I was wrong.

    What I’m looking to do is have a “page” (Web design for example) with “standard content” (images & text) on it, then below that I would like to list out the “posts” from a category called “Website examples”.

    I’m stuck on how to get this to work. I have seen a couple of plugins, but I think I need the flexibility of not using one for this, as I need to customise the layout.

    Can anyone help me please?

Viewing 1 replies (of 1 total)
  • Thread Starter Ash

    (@ashbryant)

    Answered my own question.

    <?php /*
    Template Name: ListPostsInCategoryThatHasSameNameAsPage
    */ ?>
    
    <?php get_header(); ?>
    
    <div id="content">
    <div id="main">
    
    	<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    	<h1><?php the_title(); ?></h1>
    		<?php the_content(); ?>
    	<?php endwhile; else: endif; ?>
    
    	<?php query_posts('category_name='.get_the_title().'&post_status=publish,future');?>
    	<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    	<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
    	<p><?php the_content(); ?>
    	<?php endwhile; else: endif; ?>
    
    </div>
    </div>
    
    <?php get_footer(); ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Page template that has page content & lists posts’ is closed to new replies.