• This is the page I’m working on: https://asplashofcoloronline.com/category/tips/

    It seems that the the_excerpt tag adds <p> </p> in the excerpt. I want to take that out. And I want to add an indent. I’ve tried doing it with css, but to no avail.

    So I’m looking for where the function is and maybe I can adjust it there.

    BTW,
    here is the css I tried. Maybe I goofed that up:

    .moveupandover {
    margin: -15px 0 0 15px;
    }

    <span class=”moveupandover”><?php the_excerpt(); ?></span>

    ========
    thanks,
    K

Viewing 7 replies - 1 through 7 (of 7 total)
  • <?php
    /*
    Plugin Name: No Excerpt-P
    Description: Removes the paragraph tags from the output returned by the_excerpt() function
    Version: 1.0
    Author: Amit Gupta
    Author URI: https://blog.igeek.info/
    */
    remove_filter('the_excerpt', 'wpautop');
    ?>

    Just copy all that into a text file, rename it blah.php and upload it to your plugins folder. Activate it, and youre done.

    Thread Starter kappaluppa

    (@kappaluppa)

    FANTASTIC! Works like a charm!
    thanks for the quick response!
    K

    Thread Starter kappaluppa

    (@kappaluppa)

    Another question…
    how to change the […] to “Read More…” or some such?

    Sweet! I had the same problem and that fixed it :-).

    @Kappuluppa: one thing you can do is go back through your posts and fill in the “optional excerpt” bit at the bottom of the write post admin panel. WordPress will use this excerpt rather than the generated one.

    This is what my template looks like:
    <?php the_excerpt(); ?><span class="readmore"><a href="<?php the_permalink ?>">Read This</a></span>

    natalie

    (@natalie)

    NOTE: You don’t actually need to make a plugin for this. It will work simply by adding the code anywhere on your page… <?php remove_filter('the_excerpt', 'wpautop'); ?>

    Kilroy

    (@kilroy)

    The code can also be placed in the functions.php file.

    Thanks for this solution anyway, it took me a while to find it.

    Thanks for that line of code !
    I got close to crazy with trying to validate my tamplate…

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘removing <p> tag from the_excerpt’ is closed to new replies.