Skip to main content
Fixed indentation and grammar.
Source Link

I had problems with the chosen answer when trying to use the code several times in the same page. It kept on displaying all of my pages content at the same time in every instance. So I went back to thinking and came up with this simpler approach based on the WordPress Codex's documentation:

<?php $query = new WP_Query( array( 'pagename' => 'about-me' ) );
        while ( $query->have_posts() ) {
        $query->the_post();
        echo '<h2>'. get_the_title() .'</h2>';
        the_content();
    }
    wp_reset_postdata();
?>

Maybe it can still be helpful forto somebody out there ;D

I had problems with the chosen answer when trying to use the code several times in the same page. It kept on displaying all of my pages content at the same time in every instance. So I went back to thinking and came up with this simpler approach based on the WordPress Codex's documentation:

<?php $query = new WP_Query( array( 'pagename' => 'about-me' ) );
        while ( $query->have_posts() ) {
        $query->the_post();
        echo '<h2>'. get_the_title() .'</h2>';
        the_content();
    }
    wp_reset_postdata();
?>

Maybe it can still be helpful for somebody out there ;D

I had problems with the chosen answer when trying to use the code several times in the same page. It kept on displaying all of my pages content at the same time in every instance. So I went back to thinking and came up with this simpler approach based on the WordPress Codex's documentation:

<?php $query = new WP_Query( array( 'pagename' => 'about-me' ) );
    while ( $query->have_posts() ) {
        $query->the_post();
        echo '<h2>'. get_the_title() .'</h2>';
        the_content();
    }
    wp_reset_postdata();
?>

Maybe it can still be helpful to somebody out there ;D

Source Link

I had problems with the chosen answer when trying to use the code several times in the same page. It kept on displaying all of my pages content at the same time in every instance. So I went back to thinking and came up with this simpler approach based on the WordPress Codex's documentation:

<?php $query = new WP_Query( array( 'pagename' => 'about-me' ) );
        while ( $query->have_posts() ) {
        $query->the_post();
        echo '<h2>'. get_the_title() .'</h2>';
        the_content();
    }
    wp_reset_postdata();
?>

Maybe it can still be helpful for somebody out there ;D