Support » Fixing WordPress » Posts within Page

  • Resolved greencode

    (@greencode)


    I think I’m going a little mad! I have created a page template to be used for my homepage. On there there are a number of custom fields and I would also like to display the content of 3 posts.

    What’s happening with the code I’m using below is the first custom field is showing (custom-1) and the 3 posts but then everything after that i.e. the next custom field (custom-2) is not.

    I know this is a basic mistake on my part but I can’t think what I’ve done wrong… It’s been a long day (that’s what excuse I’m using anyway 😉

    <?php
    /**
     * Template Name: Test Page
    **/
    
    get_header(); ?>
    
    		<div id="primary">
    			<div id="content" role="main">
    
    	<div class="entry-content">
    
    <?php echo get_post_meta($post->ID, 'custom-1', true); ?>
    
    <?php query_posts('cat=1&showposts=3');?>
    <?php while (have_posts()) : the_post(); ?>
    <div>
    <?php
    global $more;
    $more = 0;
    the_content("More...");
    ?>
    </div>
    <?php endwhile;?>
    
    <?php echo get_post_meta($post->ID, 'custom-2', true); ?>	
    
    	</div><!-- .entry-content -->
    
    			</div><!-- #content -->
    			<?php get_sidebar(); ?>
    		</div><!-- #primary -->
    
    <?php get_footer(); ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Posts within Page’ is closed to new replies.