$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>homepage - blog page showing as homelanding page despite template change and reading settings|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

homepage - blog page showing as homelanding page despite template change and reading settings

matteradmin10PV0评论

Live site.

I'm having trouble pinpointing exactly why the Blog page is showing up as the Home/landing page. I've changed the page template to General/page.php and have WP reading settings set to Front Page as Static/Home, and Posts page as Blog. Any ideas? All of the other pages I've set to use the General template have done so without issue.

index.php

<?php get_header(); ?>

<div id="container">
    <div id="landing">
        <div id="intro">
            <h1>Hi, I'm Dylan Elchami-<br />a health and fitness enthusiast with a passion for inspiring.</h1>
            <p>My interests are vast and ever changing, but my virtues remain true. I love to motivate, create, make people healthier, stronger, sexier, and flat out better all while building great, unmitigated relationships along the way. Please roam my site and enjoy all the information I post for you, and if you have a question please don't hesitate to contact me- it's your way of giving back for all the free information because helping you is what makes me feel AWESOME.</p>
        </div><!-- end intro -->

        <div id="stay-in-touch">
            <p>Stay in touch-</p>
            <ul>
                <li><a href="#"><img src="<?php echo get_template_directory_uri(); ?>/img/facebook.png" alt="Like on Facebook" /></a></li>
                <li><a href="#"><img src="<?php echo get_template_directory_uri(); ?>/img/twitter.png" alt="Follow on Twitter" /></a></li>
                <li><a href="#"><img src="<?php echo get_template_directory_uri(); ?>/img/linkedin.png" alt="Connect on LinkedIn" /></a></li>
            </ul>
        </div><!-- end stay-in-touch -->

        <?php $my_query = new WP_Query( array( 'posts_per_page' => 3, 'nopaging' => true ) );
        echo $post_count;
        while ( $my_query->have_posts() ) : ( $my_query->the_post() ); ?>
        <div id="preview">
            <div id="preview-item">
                <div id="preview-headline">
                <a href="<?php the_permalink(); ?>"><?php the_title(); ?>
            </div><!-- end preview-headline -->
            <div id="preview-thumbnail">
                <?php the_post_thumbnail( array(120,102) ); ?> 
            </div><!-- end preview-thumbnail -->
            </div><!-- end preview-item --> 
        </div><!-- end preview-->
        <?php endwhile; ?>
    </div><!-- end landing -->

<?php get_sidebar(); ?>

<?php get_footer(); ?>

page.php

<?php
/*
Template Name: General
*/
?>

<?php get_header(); ?>

<div id="container">
    <div id="single">
        <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
        <?php endwhile; ?>
        <?php else : ?>
            <p>I'm not sure what you're looking for.</p>
        <?php endif; ?>

        <div id="headline">
            <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></h2>
        </div><!-- end headline -->
        <div id="post-meta">
                <p>written by <?php the_author(); ?> on <?php the_date(); ?></p>
        </div><!-- end post-meta -->
        <div id="post">
            <?php the_content('read more...'); ?>
        </div><!-- end post -->
    </div><!-- end single -->
</div><!-- end container -->

<?php get_sidebar(); ?>

<?php get_footer(); ?>

Live site.

I'm having trouble pinpointing exactly why the Blog page is showing up as the Home/landing page. I've changed the page template to General/page.php and have WP reading settings set to Front Page as Static/Home, and Posts page as Blog. Any ideas? All of the other pages I've set to use the General template have done so without issue.

index.php

<?php get_header(); ?>

<div id="container">
    <div id="landing">
        <div id="intro">
            <h1>Hi, I'm Dylan Elchami-<br />a health and fitness enthusiast with a passion for inspiring.</h1>
            <p>My interests are vast and ever changing, but my virtues remain true. I love to motivate, create, make people healthier, stronger, sexier, and flat out better all while building great, unmitigated relationships along the way. Please roam my site and enjoy all the information I post for you, and if you have a question please don't hesitate to contact me- it's your way of giving back for all the free information because helping you is what makes me feel AWESOME.</p>
        </div><!-- end intro -->

        <div id="stay-in-touch">
            <p>Stay in touch-</p>
            <ul>
                <li><a href="#"><img src="<?php echo get_template_directory_uri(); ?>/img/facebook.png" alt="Like on Facebook" /></a></li>
                <li><a href="#"><img src="<?php echo get_template_directory_uri(); ?>/img/twitter.png" alt="Follow on Twitter" /></a></li>
                <li><a href="#"><img src="<?php echo get_template_directory_uri(); ?>/img/linkedin.png" alt="Connect on LinkedIn" /></a></li>
            </ul>
        </div><!-- end stay-in-touch -->

        <?php $my_query = new WP_Query( array( 'posts_per_page' => 3, 'nopaging' => true ) );
        echo $post_count;
        while ( $my_query->have_posts() ) : ( $my_query->the_post() ); ?>
        <div id="preview">
            <div id="preview-item">
                <div id="preview-headline">
                <a href="<?php the_permalink(); ?>"><?php the_title(); ?>
            </div><!-- end preview-headline -->
            <div id="preview-thumbnail">
                <?php the_post_thumbnail( array(120,102) ); ?> 
            </div><!-- end preview-thumbnail -->
            </div><!-- end preview-item --> 
        </div><!-- end preview-->
        <?php endwhile; ?>
    </div><!-- end landing -->

<?php get_sidebar(); ?>

<?php get_footer(); ?>

page.php

<?php
/*
Template Name: General
*/
?>

<?php get_header(); ?>

<div id="container">
    <div id="single">
        <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
        <?php endwhile; ?>
        <?php else : ?>
            <p>I'm not sure what you're looking for.</p>
        <?php endif; ?>

        <div id="headline">
            <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></h2>
        </div><!-- end headline -->
        <div id="post-meta">
                <p>written by <?php the_author(); ?> on <?php the_date(); ?></p>
        </div><!-- end post-meta -->
        <div id="post">
            <?php the_content('read more...'); ?>
        </div><!-- end post -->
    </div><!-- end single -->
</div><!-- end container -->

<?php get_sidebar(); ?>

<?php get_footer(); ?>
Share Improve this question asked May 22, 2012 at 19:26 user1255049user1255049 2413 gold badges14 silver badges37 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

You should read up on the template hierarchy.

page.php is automatically used for all static page. It should NOT have a "Template Name" header in it.

home.php is for styling your BLOG page. It should have a loop that can handle multiple articles.

front-page.php is for styling static home pages.

index.php is the fallback template for all of the above files.

Post a comment

comment list (0)

  1. No comments so far