It worked well! thx again for the support
Now I want to add the post text hidden in the topic so that it will be found by the search function and properly scraped by search engine crawlers.
What changes to I have to make to my current code below to put a <div style="display:none;">...</div> with the post content?
// Removes anything that looks like a shortcode. This will remove anything in the post that
// occurs inside of brackets `[...]`.
add_filter( 'wp_discourse_excerpt', 'testeleven_remove_shortcodes' );
function testeleven_remove_shortcodes( $excerpt ) {
$excerpt = preg_replace( '/\[.*\]/', '', $excerpt );
return $excerpt;
}
// show wp posts embedded in discourse via iframe
// https://meta.discourse.org/t/wp-discourse-how-to-deal-with-shortcodes-in-post/58838/5
add_filter( 'discourse_publish_format_html', 'wpdc_custom_discourse_publish_format_html', 10, 2 );
function wpdc_custom_discourse_publish_format_html( $output, $post_id ) {
$permalink = get_the_permalink( $post_id );
ob_start();
?>
<iframe width="690" height="2000" src="<?php echo esc_url( $permalink ); ?>" frameborder="0"></iframe>
<?php
return ob_get_clean();
}