• Hi, I have a theme with only one page template and need to add another one into this piece of code {content.php}. I assume that I need to add if condition inside elseif (is_front_page() ..and somehow detect which template is set in the option for page template.
    Please help me, Here is the code of content.php:

    <?php
    
    if (is_home()) {
        if (get_option('gs_show_home_page_posts', '0') == '1') {
            include get_template_directory() . '/views/blog.php';
        }
    } elseif (is_front_page()) {
        if (get_option('gs_show_front_page_static', '0') == '1') {
            include get_template_directory() . '/views/page.php';
        }
    } else if (is_single()) {
        $format = get_post_format(get_queried_object_id());
        switch ($format) {
            case 'gallery':
                include get_template_directory() . '/views/post-gallery.php';
                break;
            case 'video':
                include get_template_directory() . '/views/post-video.php';
                break;
            default:
                include get_template_directory() . '/views/post-standard.php';
                break;
        }
    } else if (is_page()) {
        include get_template_directory() . '/views/page.php';
    } else if (is_archive() || is_search()) {
        include get_template_directory() . '/views/blog.php';
    } else if (is_404()) {
        include get_template_directory() . '/views/404.php';
    }
  • The topic ‘[kopatheme: Bold magazine] How to add multiple page templates in theme?’ is closed to new replies.