0

「フッターページ」という名前の新しい WordPress テンプレートを作成しました。WordPress で新しいページが作成され、ユーザーがテンプレート「フッター ページ」を選択すると、新しいページはナビゲーション バーに表示されません。

いくつかの調査を行ったところ、「除外パラメーターを使用して、wp_list_pages によって生成されるリストから特定のページを非表示にする」という「リストからページを除外する」というものを見つけました。しかし、テンプレートファイルをどこに置くべきかわかりませんか? それとも、これがナビゲーション バーからテンプレート ページを除外する最善の方法でしょうか?

footer-page.php の私のコードは次のとおりです。

<?php
/**
 * Template Name: Footer page
 *
 * A custom page template that does not appear in the navigation bar.
 *
 * The "Template Name:" bit above allows this to be selectable
 * from a dropdown menu on the edit page screen.
 *
 * @package WordPress
 * @subpackage Twenty_Ten
 * @since Twenty Ten 1.0
 */

get_header(); ?>

        <div id="container" class="one-column">
            <div id="content" role="main">

            <?php
            /* Run the loop to output the page.
             * If you want to overload this in a child theme then include a file
             * called loop-page.php and that will be used instead.
             */
             get_template_part( 'loop', 'page' );
            ?>

            </div><!-- #content -->
        </div><!-- #container -->

<?php get_footer(); ?>
4

1 に答える 1

0

このように試すことができます:

if (is_page('1') || is_page('5')) {
             // テンプレート「sidebar.php」を含めます。
             get_template_part( 'ループ', 'ページ' );
        }

これを読む

于 2012-12-21T04:57:43.607 に答える