• Hi all!

    I need to strip html tags from the custom excerpt published by using the_excerpt(), how could i do that?

    thanks!!

Viewing 9 replies - 1 through 9 (of 9 total)
  • <?php strip_tags(the_excerpt);?>?

    Should that not be…?

    <?php strip_tags(the_excerpt());?>

    Whoops! Spot today’s deliberate mistake…

    Thread Starter zamarrone

    (@zamarrone)

    Thanks! I tired that way before posting but it seems it don’t work with the php function…

    Zampa

    Can you post the code where you’re using it?…

    Thread Starter zamarrone

    (@zamarrone)

    Sure!

    <!-- Loop  -->
    <?php $oddentry = 'class="gray" '; ?>
    <?php query_posts('cat=14&showposts=4&offset=1'); ?>
    
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
      <div <?php echo $oddentry; ?>>
        <div class="midcolumnpost">
          <h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>		
    
    <!-- ******************* HERE IS THE EXCERPT ******************** -->
    
           <?php strip_tags(the_excerpt());?>
    
    <!-- ************************************************************ -->
    
           <div class="details">
             <?php the_time('F Y'); ?> | <?php comments_popup_link(__('Comment'), __('1 comment'), __('% comments'));?> | <a href="<?php echo get_permalink(); ?>" title="Read more">Read more...</a>
           </div>
           </div>
           </div>
    
    <?php /* Changes every other post to a different class */	$oddentry = ( empty( $oddentry ) ) ? 'class="gray" ' : ''; ?>
    
    <!-- End of Loop for middle column -->
    <?php endwhile; else : ?>
    <?php endif; ?>

    I’d like to strip html tags just from this loop. In the same page I have other loops in where I’d like to keep html in the custom excerpt.

    Thanks!

    <?php echo strip_tags(get_the_excerpt());?>

    That works, though the tags still exist in the article, they are stripped off when the post is displayed…

    Thread Starter zamarrone

    (@zamarrone)

    ok, it works fine!

    thank you a lot! ??

    ?? Happy it works for you… ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Strip html tags from Custom Excerpt’ is closed to new replies.