Viewing 15 replies - 1 through 15 (of 19 total)
  • look in your index.php file. replace
    <?php the_content(); ?>
    with
    <?php the_excerpt() ?>

    Thread Starter thehealthyskeptic

    (@thehealthyskeptic)

    Which index.php file? The one in my root directory only has this:

    ‘<?php
    /* Short and sweet */
    define(‘WP_USE_THEMES’, true);
    require(‘./wp-blog-header.php’);
    ?>’

    In the index.php file within my theme, I was able to find the code you listed and change it to ‘<?php the_excerpt() ?>’ but absolutely nothing changed. I still see the full-length posts on my index screen.

    How many lines of the post does an excerpt show?

    are you sure the change is being saved? its the index page of your theme, once youve made the change, leave the file, then go back into it to make sure what you changed is still there.
    unless you have really short posts, you should see a difference.

    Thread Starter thehealthyskeptic

    (@thehealthyskeptic)

    Thanks for your reply. I have definitely changed it, the change is definitely being saved, and yet the excerpts aren’t appearing.

    Take a look: https://thehealthyskeptic.org

    ???

    are you sure youre changing the index file in the right theme folder? it would be in wp-content/themes/tarski/

    Thread Starter thehealthyskeptic

    (@thehealthyskeptic)

    Yep. That’s the file. Here’s the relevant section of code:

    ‘<div class=”content”>
    <?php the_excerpt(); ?>
    </div>’

    Could there be something in the theme that overrides the change?

    Thread Starter thehealthyskeptic

    (@thehealthyskeptic)

    Must be a theme-specific issue, because I switched to the default theme and changed “the_content” to “the_excerpt” in that theme and it worked just fine. Something in Tarski is preventing that change from taking effect. I’ve posted a message to the Tarski support forum, but if you have any ideas I’d love to hear them!

    its hard to tell without being able to look at the theme files.

    I just had a look at this theme. thehealthyskeptic, study your theme more closely. What do you see in index.php? I see this at the top …

    <?php if(is_single() || is_page()) { // Single entries and pages ?>
    
    <-------code------------->
    
    <?php } else { ?>
    <?php include(TEMPLATEPATH.'/loop.php'); ?>
    
    <-----more code-------->

    What does that say? It says if we are on single.php or page.php DO THIS. In this case THIS being the_content otherwise (ELSE) call <?php include(TEMPLATEPATH.'/loop.php'); ?>

    The changes you want to make are in loop.php

    Thread Starter thehealthyskeptic

    (@thehealthyskeptic)

    LenK,

    Thanks for pointing that out. I’m still a novice with all of this, and on somewhat of a crash course here.

    I changed the reference in “loop.php” and that worked. However, my question now is whether there’s some way of automatically inserting the <–more!–> code at the end of every post automatically so that the reader can click through to the full post?

    Thanks.

    No, but I think this is what you want to do:

    Add after <?php the_excerpt(); ?>
    <p><a href="<?php the_permalink() ?>">Continue to read the full post of "<?php the_title(); ?>" ...</a></p>

    I’m still a novice with all of this, and on somewhat of a crash course here.

    I can appreciate that. That’s why I told you to study loop.php rather than give you a cut and paste answer so that you can learn and understand the logic behind it. ??

    way of automatically inserting the <--more!--> code at the end of every post automatically so that the reader can click through to the full post?

    Now you’ve lost me. If you’re using the_content then yes but not if you’re using the_excerpt. The way you had it originally will spit out the contents of the post and stop where the <--more--> tag is inserted.

    Or you can try haochi’s suggestion. He’s a smart cookie. ??

    Thread Starter thehealthyskeptic

    (@thehealthyskeptic)

    Thank you both – that’s exactly what I was looking for!

    I’m trying to do the same thing here.

    I can add:

    <p>“>Read More”<?php the_title(); ?>” …</p>

    and it will link to the permalink.

    The problem I encounter is that EVERY post now has a “Read More…” link. Is it possible to set this to be conditional – only if a post is being cut-off/shortened by default?

    I get cut here:
    https://www.mightyfunk.com/2008/04/
    and:
    https://www.mightyfunk.com/category/photography/

    The reader wouldn’t know that ‘More’ of the post existed.

    When they both should have a “Read More…” linking to a page like:
    https://www.mightyfunk.com/2008/04/photography-placeholder/

    I need to add that I am just testing this system. I haven’t put anything in the ‘Excerpt’ section – just in the ‘Post.’

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘How do I display excerpts of posts on my index page?’ is closed to new replies.