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
}
?>
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
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 »'); ?>
</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