Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
WordPress中的菜单_Wordpress - Fatal编程技术网

WordPress中的菜单

WordPress中的菜单,wordpress,Wordpress,当我安装WordPress时,我有一个主菜单。编辑时,我在菜单中添加了一个菜单项,但我的主菜单项消失了 我不知道发生了什么事。如何添加链接回主页的主菜单项?我不确定添加另一项后您的主菜单项为何会消失,但请确保您的主题使用了wp_page_menu(): 这样做的好处是将您的“主页”与其他页面一起列出。编辑header.php中的行 wp_页面_菜单('show_home=1') 法典中的引用:如果您已经添加了Home as菜单,则将index.php的内容复制到Home.php(在主题中创建此

当我安装WordPress时,我有一个主菜单。编辑时,我在菜单中添加了一个菜单项,但我的主菜单项消失了


我不知道发生了什么事。如何添加链接回主页的主菜单项?

我不确定添加另一项后您的主菜单项为何会消失,但请确保您的主题使用了wp_page_menu():


这样做的好处是将您的“主页”与其他页面一起列出。

编辑header.php中的行

wp_页面_菜单('show_home=1')


法典中的引用:

如果您已经添加了Home as菜单,则将
index.php
的内容复制到
Home.php
(在主题中创建此空文件)文件中


然后运行并检查主页。

步骤1。要链接主页,请创建
index.php
作为主页的模板文件,如下所示:

如果您使用的是自定义主题(在除twentyelevan、twentyten等以外的wp内容的主题文件夹中自己创建的主题),请使用这些代码

<?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(); ?>

//无论你需要什么样的身体代码,你都可以在这里包含它。

你有网站的链接吗


它可能像选中一个框一样简单。或者,您可以创建一个自定义菜单。

我没有在代码中修改。我使用的是TypedBase主题。我所做的一切都是从管理面板中完成的。知道我哪里做错了吗?如果您删除刚才添加的菜单项,主菜单项会回来吗?可能只是一些css问题吗?我尝试删除了新添加的菜单项菜单项。但主菜单项没有显示。它以前显示过。因此,我认为代码(post template.php)中应该没有问题。现在我在菜单中添加了一个页面作为主页。但我需要将其链接到主页。我如何才能做到这一点。
<?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>