i using this code:
<?php ob_start(); echo '<div class="judul"><h3 style="text-align: center;"><strong>Download <?php echo esc_html( $judul ); ?> Batch Kumpulan Subtitle Indonesia</strong></h3></div>';
echo '<p><div class="deps"><h4>';
echo "<strong>Episode $bepisode</strong></h4>";
echo '</div></p>';
echo '<div class="dfr">';
echo "<strong>$bkualitas</strong><br/>";
echo '</div>';
echo '<div class="dln">';
echo " <strong>$blink</strong><br/><br/>";
echo '</div>';
echo '<div class="dfr">';
echo "<strong>$bkualitas2</strong><br/>";
echo '</div>';
echo '<div class="dln">';
echo " <strong>$blink2</strong><br/><br/>";
echo '</div>';
echo '<div class="dfr">';
echo "<strong>$bkualitas3</strong><br/>";
echo '</div>';
echo '<div class="dln">';
echo " <strong>$blink3</strong><br/><br/>";
echo '</div>'; $out = ob_get_clean(); ?>
then using this code in single.php :
<?php echo do_shortcode( '[restabs alignment="osc-tabs-center" responsive="false" tabcolor="#c1c1c1" tabheadcolor="#0a0a0a" seltabcolor="#8c8c8c" seltabheadcolor="#ffffff" tabhovercolor="#8c8c8c" responsive="true" icon="true" text="More"][restab title="Link Batch" active="active"]' . $out . '[/restab][/restabs]' );?>
why there is no meta value output?
but without using ob_get_clean(); and shortcode, i can get output like this :
does ob_get_clean(); clear all $value? or $value doesn't work with shortcode?
i using this code:
<?php ob_start(); echo '<div class="judul"><h3 style="text-align: center;"><strong>Download <?php echo esc_html( $judul ); ?> Batch Kumpulan Subtitle Indonesia</strong></h3></div>';
echo '<p><div class="deps"><h4>';
echo "<strong>Episode $bepisode</strong></h4>";
echo '</div></p>';
echo '<div class="dfr">';
echo "<strong>$bkualitas</strong><br/>";
echo '</div>';
echo '<div class="dln">';
echo " <strong>$blink</strong><br/><br/>";
echo '</div>';
echo '<div class="dfr">';
echo "<strong>$bkualitas2</strong><br/>";
echo '</div>';
echo '<div class="dln">';
echo " <strong>$blink2</strong><br/><br/>";
echo '</div>';
echo '<div class="dfr">';
echo "<strong>$bkualitas3</strong><br/>";
echo '</div>';
echo '<div class="dln">';
echo " <strong>$blink3</strong><br/><br/>";
echo '</div>'; $out = ob_get_clean(); ?>
then using this code in single.php :
<?php echo do_shortcode( '[restabs alignment="osc-tabs-center" responsive="false" tabcolor="#c1c1c1" tabheadcolor="#0a0a0a" seltabcolor="#8c8c8c" seltabheadcolor="#ffffff" tabhovercolor="#8c8c8c" responsive="true" icon="true" text="More"][restab title="Link Batch" active="active"]' . $out . '[/restab][/restabs]' );?>
why there is no meta value output?
but without using ob_get_clean(); and shortcode, i can get output like this :
does ob_get_clean(); clear all $value? or $value doesn't work with shortcode?
Share Improve this question asked Feb 10, 2017 at 3:55 ArehaAreha 11 bronze badge2 Answers
Reset to default 1You don't see anything because you're assigning the content to $out
but then you don't do anything with that value. Shortcodes have to return
their content or you won't see any output.
$out = ob_get_clean();
return $out;
or just
return ob_get_clean();
function id_shortcode() {
ob_start();
?>
<HTML> <here> ...
<?php
return ob_get_clean();
} ?>
If have query in shortcode don't foget wp_reset_postdata();
after return ob_get_clean();