Site icon Hip-Hop Website Design and Development

Exchange shortcode in substring

I’ve created these two features to toggle between the primary paragraph of the content material after which every thing however the first paragraph so when the consumer selects ‘Extra’ it slides out the article easily with out changing the primary paragraph that is already displayed because the excerpt.

Nonetheless if there is a shortcode in that textual content it exhibits up because the shortcode syntax reasonably than displaying correctly. I perceive why it isn’t displaying however I would like to exchange any shortcodes within the textual content so simply present up as textual content as an alternative of shortcode syntax wrapped in brackets.

operate get_first_paragraph(){
    international $put up;

    $str = wpautop( str_replace( 'src="http://', 'src="https://', get_the_content() ));
    $str = substr( $str, 0, strpos( $str, '</p>' ) + 4 );
    $str = strip_tags($str, '<a><robust><em>');

    return '<p>' . $str . '</p>';
}
operate get_the_post(){
    international $put up;
    $str = wpautop( str_replace( 'src="http://', 'src="https://', get_the_content() ));
    $str = substr( $str, (strpos( $str, '</p>')));
    return $str;
}