• Hi

    May you please tell me how can we displays different posts in a particular page execept home page suppose i am making a page – Test – by write page and after that i wrote 5 posts and i want that all these posts will be display on the test page how can i set up this setting please guide me. I am able to extend the page by page parent field. but in a page i want to configure post in it. Please reply to me ASAP.

    Thanks in Advance
    Shilpa

Viewing 4 replies - 1 through 4 (of 4 total)
  • Put this code in whatever place (inside the theme) you want the posts to display –

    <?php
    global $post;
    if (is_page()) {
    	// Put you code for displaying post
    } else {
    	// Put what to display if it's not page
    }
    ?>
    Thread Starter shilpa123

    (@shilpa123)

    hi

    please tell me in the details i am using theme atahualpa.2.01.zip_FILES/ theme please tell me in the details where in which folder and in which file we can place that code. I am not getting it completly.

    Thanks and Regards
    Shilpa

    Thread Starter shilpa123

    (@shilpa123)

    hi

    i am just downloading the theme and adding posts and page by wp-admin.

    The way I handle this is to create a new page template in your theme’s root directory. Call it “page-template-whatever.php”.
    In that new file, you can add this code:

    <?php
    /*
    Template Name: YourTemplateName
    */
    ?>
    
    <?php get_header(); ?>
    
    	<div id="content">
    
    	<h1><?php the_title(); ?></h1>
    
    	<?php query_posts("cat=27&showposts=5"); ?>
    			<?php if (have_posts()) : ?>
    				<?php while (have_posts()) : the_post(); ?>
    
    				<div class="post" style="margin-bottom: 15px;">
    					<?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> -->
    
    					<p style="margin-top: -10px; margin-bottom: -8px;"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><strong><?php the_title(); ?></strong></a>
    
    					<?php the_excerpt('Read the rest of this entry &raquo;'); ?>
    				</div>
    
    				<?php endwhile; ?>
    
    			<?php else : ?>
    
    				<h2 class="center">Not Found</h2>
    				<p class="center">Sorry, but you are looking for something that isn't here.
    
    				<?php include (TEMPLATEPATH . "/searchform.php"); ?>
    
    			<?php endif; ?>
    
    	</div> <!-- end #content -->
    
    <?php get_footer(); ?>

    The top part just tells WordPress what the template name will be, and when you write/edit your page, you can select this as a template and it will process this code.

    Basically, this is a static page that gets the most recent 5 posts that are in the category with ID of 27. This is just an example. Feel free to look in the codex (http://codex.wordpress.org/Pages) on how to modify this to suit your needs.

    http://ryanpharis.com

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How can i put posts in a page except home page’ is closed to new replies.