Your custom function show_post()
uses get_page_by_slug()
to retrieve the specified page.
Looking at source, it doesn’t look like get_page_by_slug()
uses post_status
. So, you’ll need to query $post->post_status
within your show_post()
function if you want to account for it in the function output:
<?php
function show_post( $path ) {
$post = get_page_by_path( $path );
$content="";
if ( 'publish' == $post->post_status ) {
$content = apply_filters( 'the_content', $post->post_content );
}
echo $content;
}
?>