You appear to be a bot. Output may be restricted
Description
Implement 'the_content' filter specifically for the oik_shortcodes or oik_class post typesNote: Since this function can be invoked multiple times we have to stop it from going recursive on us when other routines invoke the 'the_content' filter. We would like to do this by
- testing to see if the content being filtered is the current post
- testing if we need to append additional content
- updating the global post with this additional content.
Usage
$string = oiksc_the_content( $content );
Parameters
- $content
- ( string ) required – the current content of the post
Returns
string $content – the filtered content of the postSource
File name: oik-shortcodes/oik-shortcodes.phpLines:
1 to 23 of 23
function oiksc_the_content( $content ) { if ( !oiksc_is_block_editor() ) { global $post; static $contented = null; bw_trace2( $post, "global post", true, BW_TRACE_DEBUG ); if ( $post ) { if ( ( $post->post_type == "oik_shortcodes" ) && $contented === null && ( false === strpos( $content, "[bw_code " ) ) ) { $contented = $content; $content .= oiksc_the_post_oik_shortcodes( $post ); //$post->post_content = $content; } elseif ( ( $post->post_type == "oik_class" ) && $contented === null && ( false === strpos( $content, "[" ) ) ) { $contented = $content; $content .= oiksc_the_post_oik_class( $post ); //$post->post_content = $content; } elseif ( ( $post->post_type == "oik_sc_param" ) && $contented === null && ( false === strpos( $content, "[" ) ) ) { $contented = $content; $content .= oiksc_the_post_oik_sc_param( $post ); } } } return( $content ); }View on GitHub