removing <p> tag from the_excerpt (8 posts)

  1. kappaluppa
    Posted 9 years ago #

    This is the page I'm working on: http://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.

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

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

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


  2. whooami
    Posted 9 years ago #

    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: http://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.

  3. kappaluppa
    Posted 9 years ago #

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

  4. kappaluppa
    Posted 9 years ago #

    Another question...
    how to change the [...] to "Read More..." or some such?

  5. auschick
    Posted 9 years ago #

    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>

  6. natalie
    Posted 8 years ago #

    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'); ?>

  7. Kilroy
    Posted 8 years ago #

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

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

  8. krembo99
    Posted 8 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic