Post emergency WordPress questions for fast help... ...Or answer questions first & win prize money.

$5
Show complete post, not excerpt...

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"> '.__('Pages:','gravy').' ',
'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>'.__('Tagged as:','gravy').' ', ', ', '</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(); ?>

Mark Garretson | 01/26/10 at 12:15am | RSS Answers

(3) Possible Answers Submitted...

  • avatar
    Last edited:
    01/26/10
    12:22am
    Brandon Dove says:

    You could add another test case for categories


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



    <?php the_content(); ?>



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

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



    <?php } ?>

    • Mark Garretson says:

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

    • Brandon Dove says:

      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 says:

      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 says:

      Yep. Use the code that Jeff posted.

  • avatar
    Last edited:
    01/26/10
    1:37am
    Jeff Owens says:

    Yes, you can do this by specifying:

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

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

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

    <?php } ?>

  • avatar
    Last edited:
    01/26/10
    11:47am
    Julio Protzek says:

    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 :)

This question has expired.