Remove Image Caption from being called in an excerpt

by Jon Trejo   Last Updated January 12, 2018 21:08 PM

I'm using the Avada theme (Version 4.9) [fusion_recent_posts] short code to call my blog roll onto my homepage.

But there's an issue. When I place an image at the top of a post with a caption, the caption is called into the excerpt on my homepage.

Is there a way I can suppress [caption] from being called within [fusion_recent_posts]?

I've tried:

  • strip_shortcodes
  • disable_captions

Here's what I'm working with:

if ( 'yes' == $title ) {
                    $content .= ( function_exists( 'fusion_builder_render_rich_snippets_for_pages' ) ) ? fusion_builder_render_rich_snippets_for_pages( false ) : '';
                    $entry_title = '';
                    if ( $fusion_settings->get( 'disable_date_rich_snippet_pages' ) ) {
                        $entry_title = 'entry-title';
                    }
                    $content .= '<h4 class="' . $entry_title . '"><a href="' . get_permalink( get_the_ID() ) . '">' . get_the_title() . '</a></h4>';
                } else {
                    $content .= fusion_builder_render_rich_snippets_for_pages();
                }

                if ( 'yes' == $meta ) {

                    $comments = $comments_link = '';
                    ob_start();
                    comments_popup_link( esc_attr__( '0 Comments', 'fusion-builder' ), esc_attr__( '1 Comment', 'fusion-builder' ), esc_attr__( '% Comments', 'fusion-builder' ) );
                    $comments_link = ob_get_contents();
                    ob_get_clean();

                    $comments = '<span ' . FusionBuilder::attributes( 'meta-separator' ) . '>|</span><span>' . $comments_link . '</span>';

                    $content .= '<p ' . FusionBuilder::attributes( 'meta' ) . '><span><span ' . FusionBuilder::attributes( 'date' ) . '>' . get_the_time( $fusion_settings->get( 'date_format' ), get_the_ID() ) . '</span></span>' . $comments . '</p>';

                }

                if ( 'yes' == $excerpt ) {
                    $content .= fusion_builder_get_post_content( '', 'yes', $excerpt_words, $strip_html, $stripteaser );
                }

                if ( $count == $this->args['columns'] ) {
                    $count = 0;
                    $items .= '<div ' . FusionBuilder::attributes( 'recentposts-shortcode-column' ) . '>' . $date_box . $slideshow . '<div ' . FusionBuilder::attributes( 'recent-posts-content' ) . '>' . $content . '</div></div><div class="fusion-clearfix"></div>';
                } else {
                    $items .= '<div ' . FusionBuilder::attributes( 'recentposts-shortcode-column' ) . '>' . $date_box . $slideshow . '<div ' . FusionBuilder::attributes( 'recent-posts-content' ) . '>' . $content . '</div></div>';
                }

                $count++;

            }

            $html = '<div ' . FusionBuilder::attributes( 'recentposts-shortcode' ) . '><section ' . FusionBuilder::attributes( 'recentposts-shortcode-section' ) . '>' . $items . '</section></div>';

            wp_reset_query();

            return $html;

        }

Any help would be much appreciated!



Related Questions


how to remove featured from url

Updated March 28, 2016 08:03 AM

Issue where WP Featured Image will not display

Updated May 16, 2015 23:03 PM


How to crop image from image src

Updated June 12, 2017 17:08 PM