Hey! Making a new theme and wondering is there a way to put a post excerpt in a page. Here´s the idea: I make a page called SOMETHING Then I make a post called POST When a person goes to the page SOMETHING I want him to see a excerpt of the post POST. and when he clicks the post title or read more he gets to the full post. Is this possible? Here´s my page.php at the moment. <?php get_header(); ?> <div id="contentbg"> <div id="content"> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <h2><?php the_title(); ?></h2> <div class="entry"> <?php the_content(); ?> </div> <?php endwhile; else: ?> <h2>Woops...</h2> <p>Sorry, no posts we're found.</p> <?php endif; ?> <p align="center"><?php posts_nav_link(); ?></p> </div> </div> <div class="clear"> </div> <?php get_footer(); ?> PHP: Do I need a page template or a single.php file? I tried googling but did not find a solution. I´m still learning wp so much of it still a mystery for me. Hope you can help me. Thanks in advance.
Put this <?php query_posts('p=xx'); ?>, which 'xx' is the post ID of the POST, before <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> then change the <?php the_content(); ?> to <?php the_excerpt(); ?> Hope my tip help =)
Thanks! Worked like a charm! I put the code on page template so it doesnt affect other pages. One question still if you don´t mind I changed your <?php query_posts('p=xx'); ?> to this <?php query_posts('cat=movies&showposts=5'); ?> so it would only show posts from the category MOVIES. Then i made a post and put it in the GENERAL category, but it still showed up on the page where was supposed to show only MOVIES category posts. What´s wrong? So grateful if you could help me with this one also. Also learning php step by step still... Thanks!
It is because you are using the wrong syntax. Use this instead <?php query_posts('category_name=movies&showposts=5'); ?> If I really helped giving a reputation won't hurt =)) Thanks
Thanks that did the trick! And of course I´ll give rep...did not remember it..been a while since I´ve been in the forums