WordPress.org

Support

Support » How-To and Troubleshooting » Display Post of category in a page with custom page template

Display Post of category in a page with custom page template

  • Hi All,

    I’m trying to create custom pages templates for each post category to show up underneath the intro of that particular page. (with help form this post:

    But… I can not get it to work, the template is successfully created and shows as a page template but when i select it, the page doesn’t want to show…
    can someone take a look at my code and tell me what i’m doing wrong here? I have only very basic php skills

    <?php
    /*
    Template Name: Malaysia
    */
    ?>
    <?php get_header(); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="content left">
    </div><!--/ content-->
    <?php the_content(); ?>
    <?php endwhile; endif; ?>
    <?php query_posts('category_name=Malaysia'); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php the_ID(); ?>
    <?php endwhile; endif; ?>
    <div class="sidebar right">
    	<?php get_sidebar(); ?>
    </div><!--/ sidebar-->
    <div class="clear"></div>
    <?php endwhile; endif; ?>
    <?php get_footer(); ?>

    Thanks A lot!!

  • The topic ‘Display Post of category in a page with custom page template’ is closed to new replies.