Support » Plugins and Hacks » where I need to insert a code in the_loop?

  • Resolved arazzz

    (@arazzz)


    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!!!

Viewing 10 replies - 1 through 10 (of 10 total)
  • 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.

    TechGnome

    (@techgnome)


    Moderator


    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

    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.

    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…

    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>

    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…

    TechGnome

    (@techgnome)


    Moderator


    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

    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.

    TechGnome

    (@techgnome)


    Moderator


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

    -tg

    The loop is in page.php

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘where I need to insert a code in the_loop?’ is closed to new replies.