You can’t return
an include
like that. A successful include()
itself returns 1
, and since you’re returning the return value of include
, your shortcode is displaying “1”.
Handling Returns: include returns FALSE on failure and raises a
warning. Successful includes, unless overridden by the included file,
return 1.
If you want to output a template or similar file from shortcode, you need to capture it with output buffering:
function millennium_grid() {
ob_start();
include 'mg-custom-grid.php';
return ob_get_clean();
}
add_shortcode( 'millennium', 'millennium_grid' );