create a different index.php for post in wordpress -
i'm working on wordpress has, among other things, front end page , post page showing news.
from understand, template post page uses, index.php, index.php used other pages.
the thing want create special page post, header says news, etc., don't want other pages utilize template. there way create alternative index.php (index_news.php) used show posts?
that way can utilize index_news.php post , index.php else.
thanks
edit //////////
my first alternative create new page-template (news.php) loop inside, , then, in the wordpress options, targeted post new page (news.php).
but when that, loads index.php not news.php template. maybe wrong loop. here loop i'm using:
<!-- start loop. -->
<div class="post"> <!-- display title link post's permalink. --> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="permanent link <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <!-- display date (november 16th, 2009 format) , link other posts posts author. --> <small><?php the_time('f js, y') ?> <?php the_author_posts_link() ?></small> <!-- display post's content in div box. --> <div class="entry"> <?php the_content(); ?> </div> <!-- display comma separated list of post's categories. --> <p class="postmetadata">posted in <?php the_category(', '); ?></p> </div> <!-- closes first div box --> <!-- stop loop (but note "else:" - see next line). --> <?php endwhile; else: ?> <!-- first "if" tested see if there posts --> <!-- display. "else" part tells if there weren't any. --> <p>sorry, no posts matched criteria.</p> <!-- stop loop. -->
single.php - 1 post view, if wolud modify blog index, create custom template (page-news.php) header allows separated page template:
<?php /* * template name: news page * @package wordpress */ ?>
and utilize loop within of it. case think better, can modify header.php , utilize wordpress conditional tags such as: is_front_page(), is_page() or work you: http://codex.wordpress.org/conditional_tags
there many ways same ;).
wordpress
No comments:
Post a Comment