I have custom WP plugin, which registers some shortcodes and run them in Post typically. One Post typically has 2 or more of these shortcodes. I need to find out if the first shortcode was executed and changed Post HTML somehow - so the second and next runs of shortcode don´t replace the HTML made by first shortcode run.
But I don´t know how.
I know, that it should be done by adding some parameter to shortcode like [shortcode first_run="true"], but it is the last acceptable solution, because it demands changing of previously generated shortcodes in Posts. I know I can´t use get_the_content() - it shows the Post content from DB before shortcode runs. I know I can´t use the_content() - cause it cycle the WP run
Thank you for help.
My sample of code (it doesn´t help too much I guess, but.. just to imagination):
function joreviewstable_func( $atts ) {
if (is_singular() || is_tag() ) {
$a = shortcode_atts( array(
'type' => "",
'id' => NULL,
'params' => NULL,
'limit' => NULL,
'tablesorter_disable' => NULL,
'disallow_images' => NULL,
'product_ids' => NULL,
'manufacturer' => NULL,
'manufacturer_serie' => NULL,
'no_sum' => NULL,
'custom_order' => NULL,
'vertical_design' => NULL
), $atts );
require_once( plugin_dir_path( __FILE__ ) . 'inc/shortcode.php');
$return = jo_reviews_shortcode_generate_table( $a['type'], $a['id'], $a['params'],
$a['limit'], $a['tablesorter_disable'], $a['disallow_images'],
$a['product_ids'], $a['manufacturer'], $a['manufacturer_serie'],
$a['no_sum'], $a['custom_order'], $a['vertical_design'] );
//$return = "<table><tr><td>data</td></tr></table>";
return $return;
} else {
return NULL;
}
add_shortcode( 'joreviewstable', 'joreviewstable_func' );
The jo_reviews_shortcode_generate_table function do some magic and returns html back to joreviewstable_func.
But I don´t know, how to get the edited Post HTML to strpos if it contains something.