0

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 "&nbsp;&nbsp;&nbsp;&nbsp;<strong>$blink</strong><br/><br/>";
echo '</div>';
echo '<div class="dfr">';
echo "<strong>$bkualitas2</strong><br/>";
echo '</div>';
echo '<div class="dln">';
echo "&nbsp;&nbsp;&nbsp;&nbsp;<strong>$blink2</strong><br/><br/>";
echo '</div>';
echo '<div class="dfr">';
echo "<strong>$bkualitas3</strong><br/>";
echo '</div>';
echo '<div class="dln">';
echo "&nbsp;&nbsp;&nbsp;&nbsp;<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? the meta value doesn't show

but without using ob_get_clean(); and shortcode, i can get output like this : output

does ob_get_clean(); clear all $value? or $value doesn't work with shortcode?

2 Answers 2

1

You 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();
0
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();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.