Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Show complete post, not excerpt... WordPress

  • SOLVED

I would like to modify the way this category post is displayed. It is currently showing excerpts, I would like to display the complete post on one page ... http://lemonadecleansetogo.com/other/videos/

Here is the code for the loop >


<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

<?php if (is_single() || is_page()) {
// This links the page- or post-title where necessary, and otherwise displays as plain text
?>

<?php } elseif (is_search()) { ?>

<h2 class="posttitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php search_title_highlight(); ?></a></h2>

<?php } else { ?>

<h2 class="posttitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>

<?php } ?>

<div class="entry">
<?php if (is_archive()) {
// This displays an excerpt or the entire post, depending on the context
?>

<?php the_excerpt(); ?>

</div><!--/end entry-->
</div><!--/end post-->

<?php } elseif (is_search()) { ?>

<?php search_excerpt_highlight(); ?>

</div><!--/end entry-->
</div><!--/end post-->

<?php } else { ?>
<?php the_content(); ?>

<?php wp_link_pages(array(
'before' => '<p class="nextpage"><strong> '.__('Pages:','gravy').' </strong>',
'after' => '</p>',
'next_or_number' => 'number'));
?>

<?php if (is_single())
// This adds Tags and 'Edit' link to single-post pages
{ ?>

<p id="tags"><?php the_tags('<span><strong>'.__('Tagged as:','gravy').'</strong> ', ', ', '</span>'); ?></p>
<?php } ?>



<?php edit_post_link(__('Edit this entry','gravy'), '<p id="wp-edit">', '&raquo;</p>'); ?>


</div><!--/end entry-->
<?php if (!is_page()) {
// This inserts metadata everywhere except on Pages
?>

<?php } ?>

</div><!--/end post-->

<?php } ?>


And here is the code for the video template page >

?php
/*
Template Name: video
*/
get_header(); ?>

<div id="content">
<h2 class=posttitle>VIDEOS</h2>
<?php query_posts('category_name=video'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<?php include (TEMPLATEPATH . '/loop.php'); ?>
<?php endwhile; ?>
<?php include (TEMPLATEPATH . '/pagination.php'); ?>

<?php else : ?>
<h2>
<?php _e('Not Found','gravy'); ?>
</h2>

<?php endif; ?>
</div>
<!--/content-->
<?php get_sidebar('other'); ?>
<?php get_footer(); ?>

Answers (3)

2010-01-26

Julio Protzek answers:

The problem on your code is the line that says
<?php if (is_archive()) {

Category, Tag, Author and Date based pages are all types of Archives.

So on the videos category page, each post is showed by the block inside the <?php if (is_archive()) { rather the <?php } else { ?> block as you would expect.

The easiest way to send the video category posts to the <?php } else { ?> block is creating a little filter. Change this if statement:
<?php if (is_archive()) {
to something more specific:
<?php if (is_archive() && !is_category('video')) {

This statement says: "If is archive but not video category then..."

This way your video category posts will end up on the <?php } else { ?> block.

Happy WP coding :)

2010-01-26

Brandon Dove answers:

You could add another test case for categories

<?php } elseif (is_category()) { ?>



<?php the_content(); ?>



</div><!--/end entry-->

</div><!--/end post-->



<?php } ?>


Mark Garretson comments:

I don't follow .. what is a test case?


Brandon Dove comments:

In the loop file, there are a series of "if" statements. You just need another one to test if it's a category. Look for the part right below:

<div class="entry">


Mark Garretson comments:

In the loop - can I specify a specific category like videos? I want the other categories to display excerpts - but the videos to display complete posts.


Brandon Dove comments:

Yep. Use the code that Jeff posted.

2010-01-26

Jeff Owens answers:

Yes, you can do this by specifying:

<?php } elseif (is_category('video')) { ?>

</div><!--/end entry-->

</div><!--/end post-->

<?php } ?>