Support » Themes and Templates » Child Theme with Default Page(s)

  • jw60610


    Is it possible to create a child theme that will always display a particular custom page template or templates?

    For example, let’s say I wanted to create a child theme for use in a network installation that uses a particular contact us page or if it’s a membership site uses a particular “about this network” page.

    This is as opposed to using the dropdown menu in the page edit screen.



Viewing 2 replies - 1 through 2 (of 2 total)
  • esmi


    Forum Moderator

    Totally and completely untested:

    function apply_my_template( ) {
       global $post;
       if (
            !current_user_can( 'edit_post', $post->ID )
            || 'page' != $post->post_type
            || wp_is_post_revision( $post->ID )
            || wp_is_post_autosave( $pos->ID )
            || 'auto-draft' == $post->post_status
            || 'trash' == $post->post_status
            return $post->ID;
        if ( $post->post_title == 'Contact' ) update_post_meta( $post->ID, '_wp_page_template',
    'page-my-template.php' );
    add_action( 'save_post', 'apply_my_template', 10, 2 );


    Thanks Esmi!

    I’ll check it out. Thanks for pointing me in right direction 😉


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Child Theme with Default Page(s)’ is closed to new replies.