• Resolved katanaz

    (@katanaz)


    when i activate excerpt it also shows the shortcodes used in the post like this:
    [wc_row][wc_column size=”one-half” position=”first”]This game features an intense single-player campaign, a number of cooperative…
    it should look like this:
    “This game features an intense single-player campaign, a number of cooperative…”

    the themes excerpt doese this fine. any way using the themes excerpt instead of the plugins?

    https://wordpress.org/plugins/contextual-related-posts/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Ajay

    (@ajay)

    Hi,

    The plugin strips out shortcodes using the strip_shortcodes function. Do you know what plugin / theme creates the wc_row shortcode?

    You can write your own excerpt function to filter crp_excerpt. Something on the lines of this.

    function crp_overwrite_excerpt( $output, $id, $excerpt_length, $use_excerpt ) {
    $output = PUT A FUNCTION HERE TO GET THE THEME EXCERPT FOR $id
    
    return $output
    }
    add_filter( 'crp_excerpt', 'crp_overwrite_excerpt', 10, 4 );
    Thread Starter katanaz

    (@katanaz)

    hi,
    shortcodes plugin:
    WP Canvas – Shortcodes & Shortcodes Ultimate
    Theme is:
    Hueman
    dont know where to find the themes funktion for excerpts 🙁

    Plugin Author Ajay

    (@ajay)

    You should ask the author of Hueman.

    Thread Starter katanaz

    (@katanaz)

    i probably just need to edit how your plugin gets the excerpt to something like this
    <?php echo strip_tags(get_the_excerpt()); ?>">
    just need to know where i can edit this??

    Thread Starter katanaz

    (@katanaz)

    already found the Function to create an excerpt for the post:

    function crp_excerpt( $id, $excerpt_length = 0, $use_excerpt = true ) {
    	$content = $excerpt = '';
    	if ( $use_excerpt ) {
    		$content = get_post( $id )->post_excerpt;
    	}
    	if ( '' == $content ) {
    		$content = get_post( $id )->post_content;
    	}
    
    	$output = strip_tags( strip_shortcodes( $content ) );
    
    	if ( $excerpt_length > 0 ) {
    		$output = wp_trim_words( $output, $excerpt_length );
    	}
    
    	return apply_filters( 'crp_excerpt', $output, $id, $excerpt_length, $use_excerpt );
    }

    strip tags seems to be already build in but not working?!
    any idea?

    Plugin Author Ajay

    (@ajay)

    Hi,

    That’s what I meant by my earlier reply. I already have strip_shortcode and strip_tags which strips out any HTML and inbuilt shortcodes.

    Which is why I said maybe checking with the author of Hueman, if he is doing anything special to ensure his shortcodes are stripped

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Hide [Shortcode] from excerpt’ is closed to new replies.