2012-05-23 52 views
0

我是新來的WordPress的模板編輯,我試圖讓頁面描述顯示在我的網站上,但它並沒有出現。我試圖去顯示說明的URL是在這裏:WordPress的/ PHP的 - 如何顯示頁面描述

http://fourwallsla.com/category/the-neighborhood/east-side/

,我已經把它貼WordPress的內頁介紹的截圖。它似乎在使用存檔模板(爲什麼它不使用頁面模板?)。

下面是一些存檔模板的代碼:

<div class="main"> 
<?php if (have_posts()) : $first = true; ?> 
    <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?> 
    <?php /* If this is a category archive */ if (is_category()) { ?> 
     <h1><?php single_cat_title(); ?></h1> 
    <?php /* If this is a tag archive */ } elseif(is_tag()) { ?> 
     <h1><?php single_tag_title(); ?></h1> 
    <?php /* If this is a daily archive */ } elseif (is_day()) { ?> 
     <h1><?php echo get_the_time('F jS, Y'); ?></h1> 
    <?php /* If this is a monthly archive */ } elseif (is_month()) { ?> 
     <h1><?php echo get_the_time('F, Y'); ?></h1> 
    <?php /* If this is a yearly archive */ } elseif (is_year()) { ?> 
     <h1><?php echo get_the_time('Y'); ?></h1> 
    <?php /* If this is an author archive */ } elseif (is_author()) { ?> 
     <h1><?php _e('Author Archive', 'gray_white_black'); ?></h1> 
    <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?> 
     <h1><?php _e('Blog Archives', 'gray_white_black'); ?></h1> 
    <?php } ?> 

    <ul class="post-list"> 
    <?php while (have_posts()) : the_post(); 

其中,在上面的代碼,the_post(),適度,是指在網頁上顯示的類別中的家上市的內容。但是,如何獲取頁面本身的the_post(),如截圖所示?謝謝。

enter image description here

+0

恕我直言,你這樣做是錯誤的模板:點擊這裏http://codex.wordpress.org/ Template_Hierarchy – Sergey

+0

對我來說也是如此,但我沒有構建主題,我想避免更改模板,因爲其他一切都是我的朋友在她的網站上需要的方式。 – mheavers

回答

1

它使用archive.php模板,因爲你檢索類別中的所有帖子 - 「鄰里」 &「東城」。如果你想讓它使用默認的page.php,你將不得不在Wordress中發佈一個頁面。 要打印的說明(「考試說明」)或帖子的內容,之後添加<?php the_content(); ?><?php the_excerpt(); ?>

<?php while (have_posts()) : the_post(); 
+0

謝謝 - 我的網頁已經發布。這就是添加了「測試說明」的地方 - 所以我仍然對做什麼感到困惑。我已經想出了一個解決方法,但它是硬編碼的,所以它不是理想的。我安裝了一個名爲「改進的包含頁面」的插件,該插件允許您使用其ID來輸出任何模板中的頁面內容。所以我寫了一個switch語句switch($ catName){case「east side」:iinclude_page(17);打破;我想找到一個動態的方法來做到這一點。 – mheavers

+0

如果您已經發布了該頁面,請轉到Wordpress,然後點擊查看頁面。它的永久鏈接會有所不同,它的名稱中不會有/分類。/category正在使Wordpress加載archive.php – anuragbh

+0

我剛剛在上面的截圖中注意到,你在「永久鏈接」中有「/ category /」。編輯它,並給它一個鏡頭。它應該加載page.php模板。 – anuragbh

相關問題