如何从循环外的特定ID加载内容和元数据

Here is my code I'm using. I tried a few thing but neither of them worked. Any ideas?

<?php
$id = 29; 
$post = get_post($id); 
$title = apply_filters('get_the_title', $post->post_title);
$content = apply_filters('the_content', $post->post_content);
$meta = get_post_meta($id, 'example_meta', true);
echo "<h4 class='col-12'>", $title, "</h4>";                
echo "<h2 class='col-12 col-md-11 col-lg-8 py-5'>", get_the_subtitle($post), "</h2>";
echo $content;
echo $meta;
?>

I have not test this code, i believe this will work.

    $id = 29;
$post = get_post($id);

if($post) {
    $title = get_the_title($post->ID);
    $content = do_shortcode( $post->post_content );
    $meta = get_post_meta($id, 'example_meta', true); // to make sure meta_key already exists for this posts.
    echo "<h4 class='col-12'>", $title, "</h4>";
    echo "<h2 class='col-12 col-md-11 col-lg-8 py-5'>", get_the_subtitle($post), "</h2>";
    echo $content;
    echo $meta;
}

You can setup the post data with your desired post and then reset the post data.

<?php
$id = 29; 
$post = get_post($id); 
setup_postdata($post);
$title = apply_filters('get_the_title', $post->post_title);
$content = apply_filters('the_content', $post->post_content);
$meta = get_post_meta($id, 'example_meta', true);
echo "<h4 class='col-12'>", $title, "</h4>";                
echo "<h2 class='col-12 col-md-11 col-lg-8 py-5'>", get_the_subtitle($post), "</h2>";
echo $content;
echo $meta;
wp_reset_postdata();
?>