Support » How-To and Troubleshooting » [Resolved] Remove shortcode from the_excerpt

[Resolved] Remove shortcode from the_excerpt

  • Hello guys,
    i my frontpage i am using a custom query

    <?php if ( $the_query->have_posts() ) : ?>
    <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    <div class="news">
    <div class="date"><?php the_time( 'd.j.Y') ?>:</div>
    <div class="new"><a href="<?php echo the_permalink(); ?>"><?php the_excerpt() ?></a></div>												</div>									  <?php endwhile; ?>										  <?php wp_reset_query(); ?>										<?php endif; ?>

    I am also using a social plugin that shows social button before the content inside the posts. BUT this shortcode is also shown when i use the excerpt function. How do i disable this shortcode from showing??

    I have used the following with no lack.

    Also i used the following :

    function remove_shortcode_from_index($excerpt) {
      if ( is_home() ) {
        $excerpt = strip_shortcodes( $excerpt );
      return $excerpt;
    add_filter('the_excerpt', 'remove_shortcode_from_index');

    but it does not work.

    Any other idea??
    – Konstantinos

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Remove shortcode from the_excerpt’ is closed to new replies.