WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] where I need to insert a code in the_loop? (11 posts)

  1. arazzz
    Member
    Posted 8 years ago #

    Hello,

    What I want to do is to display only 120 word long post summaries on my main page, with link to 'more...' at the end of the summary.

    I have read all I could, here and elsewhere... I downloaded *AND* installed 'the_excerpt Reloaded'. However, I need to put something like
    <?php the_excerpt_reloaded(); ?>
    in the_loop. Here, I got completely confused, because the latest WP version online support got the_loop covered is something like 1.5 (I run 2.0.2)... Now I am stuck, not knowing where *EXACTLY* to put this line and in which files.

    Anyone can help complete n00b? I need very precise and step-by-step instructions where I need to put this code.

    Thank you!!!

  2. clarke1866
    Member
    Posted 8 years ago #

    I'm not sure what theme you are using, so without looking I can guess that wherever it says the_content in your theme you'll want to replace that with the_excerpt_reloaded. If I know what theme you use I can suggest a much more accurate method.

  3. TechGnome
    Moderator
    Posted 8 years ago #

    actualy it should only be in the index.php file of what ever theme you are using. If you replace the_content in any of the other files, you might get only the short version when you expect the whole post.

    -tg

  4. clarke1866
    Member
    Posted 8 years ago #

    Good point TechGnome, you should probably only be messing with index.php. There are other circumstances when you might want to be changing things in other files, but it doesn't sound like your scenario needs this.

  5. arazzz
    Member
    Posted 8 years ago #

    Hello,

    Thank you for the replies.

    However, my main index.php is something like this:

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

    ... There's really nowhere to insert this code. Or do you mean I need to insert it into the theme's index.php? Sorry, I am real n00b... :(

    The theme I'm using is cub-reporter.

    Thank you again...

  6. clarke1866
    Member
    Posted 8 years ago #

    In the theme's index.php you have the lines:

    <div class="storycontent">
    <?php the_content(__('(more...)')); ?>
    </div>

    change it to:

    <div class="storycontent">
    <?php the_excerpt_reloaded(); ?>
    </div>

  7. arazzz
    Member
    Posted 8 years ago #

    Thank you, clarke1866! That helped... :) Somewhat...

    Now what I am getting is strangely behaving 'more...' link (when I press it, the article's page is opened, but I still see the same excerpt). I suspected that this has something to do with the_excerpt_reloaded plugin, I've tried to hack it's various variables, to no avail.

    The exact variables I'm inserting are:

    excerpt_length 100
    allowedtags all
    filter_type excerpt
    use_more_link TRUE
    more_link_text KEEP READING >>>
    force_more_link FALSE
    fakeit 1
    fix_tags TRUE

    The exact line is:

    <?php the_excerpt_reloaded(100, 'all', 'excerpt', TRUE, 'KEEP READING >>>', FALSE, 1, TRUE); ?>

    Hm...

    Thanks for any help...

  8. TechGnome
    Moderator
    Posted 8 years ago #

    Stop! Before you go any further hacking you files.... do this: Look in the theme folder of the theme you are using... is there a single.php? If NOT... then make a copy of index.php and rename it single.php. Then open it up and edit it. Change the_excerpt_reloaded to the_content() (again, make sure you are doing this in the single.php file NOT index.php.
    Save it, upload it, and then try it again.

    -tg

  9. arazzz
    Member
    Posted 8 years ago #

    TechGnome!!! All I could say is WOW!!! That sure made my day!!!

    Thank you. Thank you! THANK YOU! T H A N K Y O U !!!

    A.

  10. TechGnome
    Moderator
    Posted 8 years ago #

    Cool, I take it that it works now. I'll mark this as resolved.

    -tg

  11. merrua
    Member
    Posted 8 years ago #

    The loop is in page.php

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags