Support » Fixing WordPress » Full post permalink, short post category

  • Hi, maybe someone could help me. What I would like is the full post to appear at ‘home’ and the permalink but in ‘categories’ and ‘January, February etc.’ just a short snippet, like the first 50-100 words. I don’t want a plugin that turns all posts into snippets no matter where they appear. Does anyone know how to do this?

    Thanks everyone

Viewing 13 replies - 1 through 13 (of 13 total)
  • You need to edit your theme (whether it is archive.php or something to do with archives) and change the post being called from the_post to the_excerpt. Here is example of mine:

    <?php while (have_posts()) : the_post(); ?>

    Change to:

    <?php while (have_posts()) : the_excerpt(); ?>

    That should do it!


    Thanks very much Trent!

    Actually, Trent’s suggestion should have gone more like:

    <?php while (have_posts()) : the_post(); ?>
    <?php the_content(); ?>

    Change to:

    <?php while (have_posts()) : the_post(); ?>
    <?php the_excerpt(); ?>

    the_content() is what outputs the content of a post, and is what you want to swap out here.

    Thanks for clarifying Kaf.


    Thanks guys gonna give that a try now

    Actually, when I go to theme editor, these are the only files available to edit

    * Stylesheet
    * Footer
    * Comments
    * functions.php
    * Header
    * Main Index Template
    * Page Template
    * Sidebar

    I tried page template but that makes the Pages excerpts. What should I edit?

    In your “Main Index Template” (index.php), change the line for the_content() to the following:

    <?php if( is_home() || is_single() ) {
    } else {
    } ?>

    More info:

    Hi Kafkaesqui, thanks for all your help. I tried that but there is no code like that in my index.php file. I looked for ‘categories’ or ‘archives’ in this file and they are not there either. I also checked out that link and it recommends things that don’t seem to appear on my index.php file. I copied the whole file below so you could see it for yourself. If you have time, maybeyou could look over it. Thanks

    <?php get_header(); ?>

    <div id=”middle”>
    <div id=”content”>

    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>

    <div class=”post” id=”post-<?php the_ID(); ?>”>

    <h2>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?></h2>

    <div class=”entry”>

    <p><?php the_time(‘F jS, Y’) ?> by <?php the_author() ?></p>

    <?php the_content(‘Read the rest of this entry »’); ?>


    <ul class=”post-data”>
    <li class=”comments”>
    <?php comments_popup_link(‘No Comments »’, ‘1 Comment »’, ‘% Comments »’); ?>

    <li class=”posted”>
    Posted in <?php the_category(‘, ‘) ?> <?php edit_post_link(‘Edit’,”,”); ?>


    <?php comments_template(); ?>

    <?php endwhile; ?>

    <p align=”center”><?php next_posts_link(‘« Previous Entries’) ?> <?php previous_posts_link(‘Next Entries »’) ?></p>

    <?php else : ?>

    <h2 align=”center”>Not Found</h2>

    <p align=”center”>Sorry, but you are looking for something that isn’t here.</p>

    <?php endif; ?>

    <?php get_sidebar(); ?>


    <?php get_footer(); ?>

    Sorry to bump this guys but it got lost a few pages down. Could someone have a look at the code above and maybe let me know how I could have the ‘categories’ and ‘archive’ posts as snippets. I would like the home page and permalinks to show the full-length article. Thanks in advance.

    First, copy that index.php to archive.php. This will make your changes only take effect on archive pages (like dates, categories, etc).

    Then edit the archive.php file and change this:
    <?php the_content('Read the rest of this entry »'); ?>

    to this:
    <?php the_excerpt('Read the rest of this entry »'); ?>

    That’s the thing Otto, I don’t have an archive.php or a categories.php. Should I create these files using the code from index.php and make the relevant changes?

    bylto: Like I said before: “First, copy that index.php to archive.php”.

    The above post I made contains exactly what you need to do. Please read it.

    Or, just make the change in the template from this:

    <?php the_content('Read the rest of this entry »'); ?>

    to this:

    <?php if( is_home() || is_single() ) {
    the_content('Read the rest of this entry »');
    } else {
    } ?>

    I suggested you change the code, hence the reason there is no code in your templates like what I suggested changing it to.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Full post permalink, short post category’ is closed to new replies.