2010-12-16 65 views
-2

當我安裝WordPress時,我有一個主菜單。在編輯時,我向菜單中添加了一個菜單項,但我的主菜單項消失了。WordPress中的菜單

我不知道發生了什麼事。如何添加鏈接到主頁的主菜單項?

+0

發佈修改後的代碼 – 2010-12-16 10:30:11

+0

我沒有修改代碼。我正在使用typedbased主題。我所做的只是從管理面板。任何想法,我做錯了什麼? – Batuli 2010-12-16 10:33:53

+0

如果您刪除剛剛添加的菜單項,主菜單項是否會回來?難道只有一些CSS問題? – bobo 2010-12-16 16:38:19

回答

0

我不知道爲什麼你家的項目將增加一個項目之後已經消失,但要確保你的主題是使用wp_page_menu():

http://codex.wordpress.org/Template_Tags/wp_page_menu

這帶來列出您「家的利益「以及您的其他網頁。

+0

它之前在推廣。所以,我認爲在代碼(post-template.php)中不應該存在問題。現在我添加了一個頁面作爲主頁菜單。但我需要將其鏈接到主頁。我怎樣才能做到這一點。 – Batuli 2010-12-17 04:17:34

+0

你可以在這裏查看http://pratikshya.com.np – Batuli 2010-12-17 04:17:54

0

如果您已經添加的家庭的菜單,然後index.php內容複製到您的Home.php(創建你的主題這樣的空文件)文件。

然後運行並檢查主頁。

0

步驟1您鏈接的主頁,創建index.php爲模板文件類似家庭的代碼如下:

如果您正在使用自定義主題(主題通過自己的主題文件夾中創建使用這些代碼WP-含量比twentyelevan,twentyten等其他

<?php 
/** 
* Template Name: home 
* 
* Selectable from a dropdown menu on the edit page screen. 
*/ 
?> 
<?php get_header(); ?> 
// whatever body code u need,u can include it here. 


<?php if (have_posts()) : ?> 
<?php while (have_posts()) : the_post(); ?> 
    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> 
    <div class="post-header"> 
     <!-- <div class="date"><?php the_time('M j y'); ?></div>--> 
     <!-- <h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent 
      Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>--> 
     <!-- <div class="author"><?php the_author(); ?></div>--> 
    </div><!--end post header--> 
    <div class="entry clear"> 
    <?php if (function_exists('add_theme_support')) the_post_thumbnail(); ?> 
    <?php the_content(); ?> 
     <!-- <?php edit_post_link(); ?>--> 
    <?php wp_link_pages(); ?> 
    </div><!--end entry--> 
    <div class="post-footer"> 
    <!-- <div class="comments"><?php comments_popup_link('Leave a Comment', '1 
     Comment', '% Comments'); ?></div>-->  
    </div><!--end post footer--> 
    </div><!--end post--> 
<?php endwhile; /* rewind or continue if all posts have been fetched */ ?> 
    <div class="navigation index"> 
    <div class="alignleft"><?php next_posts_link('Older Entries'); ?></div> 
    <div class="alignright"><?php previous_posts_link('Newer Entries'); ?></div> 
    </div><!--end navigation--> 
<?php else : ?> 
<?php endif; ?> 


    <div id="slider"> 
    <?php 
    $tmp = $wp_query; 
    $wp_query = new WP_Query('posts_per_page=5&category_name=featured'); 
    if(have_posts()) : 
     while(have_posts()) : 
     the_post(); 
    ?> 
      <a href="<?php the_permalink(); ?>"><?php 
      the_post_thumbnail('nivothumb'); ?></a> 
    <?php 
     endwhile; 
    endif; 
    $wp_query = $tmp; 
    ?> 
    </div><!-- close #slider --> 

<?php get_footer(); ?> 

或者,如果你使用WordPress的內置主題,然後使用這些代碼:

<?php 
/** 
* Template Name: onebyone 
* 
* Selectable from a dropdown menu on the edit page screen. 
*/ 
?> 
<html> 
    // whatever body code u need,u can include it here. 
</html> 

第2步。然後在wordpress中打開主頁,頁面 - >所有頁面,點擊編輯。

第3步。在主頁的編輯頁面,右側會出現名爲模板的下拉菜單。點擊 下拉菜單,在那裏你會看到你的模板名稱爲首頁選擇它,然後點擊更新 按鈕。

第4步:然後,在頂部左側角球,點擊你的網站或博客的名稱和瀏覽網頁或博客 通過點擊它來檢查您的主頁。

-2

您有鏈接到您的網站?

這可能與檢查一個盒子一樣簡單。或者,您可以創建一個自定義菜單。