<?php
// Functions named with 'get' will return the content.
function prefix_get_function_name() {
ob_start();
prefix_display_function_name();
return ob_get_clean();
}
// We need to echo this function.
echo prefix_get_function_name();
// Shortcode example
function prefix_get_function_name_shortcode() {
ob_start();
<p>Here is some markup.</p>
return ob_get_clean();
}
add_shortcode( 'example_shortcode', 'prefix_get_function_name_shortcode' );
<?php
// Functions named with 'display', 'do', or 'the' will simply echo the content.
// Note: This doesn't mean using the php term 'echo'.
function prefix_display_function_name() {
?>
<p>Name</p>
<?php
}
// Use function.
prefix_display_function_name();