I've written a WordPress plugin that has a shortcode. The shortcode resides on a WordPress page on which there are other shortcodes. The other shortcodes output HTML and I would like to append HTML from my shortcode to that output.
I was wondering if I could use a DOMDocument and getElementById to accomplish this.
The WordPress page is like this:
[Shortcode #1]
[Shortcode #2]
[Shortcode #3]
[date_info]
My plugin does this:
function date_important_info(){
ob_start();
display_date($date);
$html = do_shortcode( ob_get_clean() );
return $html;
function display_date($date){ ?>
<div style="">
<span>Date:</span>
<span><?php echo $date ?></span>
</div>
<?php }
}
add_shortcode('date_info','date_important_info');
Currently, my shortcode output appears at the bottom of the Wordpress page. I want the output from my shortcode to get appended to a div in the HTML that is output by one of the other shortcodes.