Created
July 11, 2022 09:58
-
-
Save tiendungdev/e01c87bb22477b3b44a33ab6a9caec41 to your computer and use it in GitHub Desktop.
Simple shortcode with ob_start
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function vts_shortcode_box(){ | |
ob_start(); | |
?> | |
<div class="box">Content blabla</div> | |
<?php | |
$result = ob_get_contents(); | |
ob_end_clean(); | |
return $result; | |
} | |
add_shortcode('box', 'vts_shortcode_box'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment