Dynamic HTML not displaying at respective place
Question
Dynamic HTML not displaying at respective place
I have a created shortcode in function.php
and my code is,
function Post_home(){
$data='<div class="cp-seeWrapper"><div class="container"><div class="row"><div class="col-xl-8 col-lg-8 col-md-8 col-sm-12 col-xs-12">';
//some logic here
$data.='</div>';
$data.='<div class="col-xl-4 col-lg-4 col-md-4 col-sm-12 col-xs-12"><div class="cp-social">';
if (is_active_sidebar('footer-social')) :
dynamic_sidebar('footer-social');
endif;
$data.='</div><div class="cp-newsletter">';
if (is_active_sidebar('cp_newsletter')) :
dynamic_sidebar('cp_newsletter');
endif;
$data.='</div></div></div></div></div>';
return $data;
}
add_shortcode( 'home_post', 'Post_home' );
Now just notice here, Whatever I am adding the logic part that output is displaying before the parent div. I mean my parent div is cp-seeWrapper
and output is displaying before it.
I added footer-social and newsletter logic and both are displaying above parent div.
Would you help me out?
My output is
//I am getting my output here
<div class="cp-seeWrapper">
<div class="container">
<div class="row">
<div class="col-xl-8 col-lg-8 col-md-8 col-sm-12 col-xs-12">
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-sm-12 col-xs-12">
<div class="cp-social"></div>
<div class="cp-newsletter"></div>
</div>
</div>
</div>
</div>
0
plugins, posts, shortcode, wordpress.org
3 years
2019-11-01T09:12:40-05:00
2019-11-01T09:12:40-05:00 0 Answers
86 views
0
Leave an answer