Load a specific php page

I am trying to make wordpress load a specific static php file(not a page template) for wordpress pages.

For example, for the contact page i would like to load the already done contact.php.

Read More

I tried adding in functions.php something like:

if( is_page('careers')){
    get_page('careers.php');
}

or

function get_pages() {
     if(is_page('careers')) {
          return get_template_uri() . '/careers.php';
     }
 }

What am I missing?

EDIT: I’ve managed to load the pages by renaming them to page-careers.php, page-contact.php, and so on.
I tried your solutions but I had no success.

Related posts

2 comments

  1. Try this for include PHP file

    <?php include(ABSPATH . "banner.php"); ?>
    

    And get another page content

    $my_id = 5369;
    $post_id_5369 = get_post($my_id);
    $content = $post_id_5369->post_content;
    $content = apply_filters('the_content', $content);
    $content = str_replace(']]>', ']]>', $content);
    echo $content;
    

Comments are closed.