如何将HTML菜单转换为WordPress菜单(WordPress)

时间:2013-09-15 05:54:38

标签: javascript jquery html wordpress

伙计们,我的html中有以下代码。我正在使用320 bootstrap wp主题。我只是创建一个菜单。它的工作。但是上面的框没有移动到菜单到菜单。我是怎么做到的

更多解释。请访问以下链接。

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Menu Tutorial - Cufon Font Script</title>
<link rel="shortcut icon" href="images/favicon.ico" />
<!--CSS-->
<link href="styles/style.css" rel="stylesheet" type="text/css" />
<link href="styles/color.css" rel="stylesheet" type="text/css" />
<link href="styles/noscript.css" rel="stylesheet" type="text/css" id="noscript" media="screen,all"  />
<!--End testimonial-->
<script type="text/javascript" src="js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="js/cufon-yui.js"></script>
<script type="text/javascript" src="js/Ebrima_400-Ebrima_700.font.js"></script>
<script type="text/javascript">
     Cufon.replace('h1') ('h2') ('h3') ('h4') ('h5') ('h6')  ('.nivo-caption h1', {textShadow: '#000 2px 0px 2px'}) ('.nivo-caption .button');
</script>
<script type="text/javascript" src="js/jquery.lavalamp.js"></script>
<script type="text/javascript" src="js/lavalamp-config.js"></script>
<script type="text/javascript" src="js/jquery.easing.1.1.js"></script>
</head>
<body>
    <div id="wrapper">
        <div id="wrapper-top">
                <div id="top">
                    <div id="top-left"><a href="index.html">
                        <img src="images/logo.png" alt="" width="223" height="58" />It's An Image</a></div><!-- #top-left -->
                    <div id="top-right">
                        <div id="nav">
                            <ul id="topnav">
                                    <li class="active"><a href="index.html" >Home</a></li>
                                    <li><a href="about.html">About Us</a>
                                    </li>
                                    <li><a href="services.html">Services</a>
                                    <ul>
                                        <li><a href="#">Services One</a></li>
                                        <li><a href="#">Services Two</a></li>
                                        <li><a href="#">Services Three</a></li>
                                        <li><a href="#">Services Four</a></li>
                                    </ul>
                                    </li>
                                    <li><a href="#">Portfolio</a>
                                        <ul>
                                            <li><a href="#">Portfolio One</a></li>
                                            <li><a href="#">Portfolio Two</a></li>
                                            <li><a href="#">Portfolio Three</a></li>
                                        </ul>
                                    </li>
                                    <li><a href="contact.html">Contact</a></li>
                            </ul>
                            <!-- #topnav -->
                        </div><!-- #nav -->
                    </div><!-- #top-right -->
                </div><!-- #top -->
        </div><!-- #wrapper-top -->
    <script type="text/javascript"> Cufon.now(); </script> <!-- to fix cufon problems in IE browser -->
    <script type="text/javascript">jQuery('#noscript').remove();</script><!-- if javascript disable -->
</body>
</html>

To View That I Expect

解释

  1. 您可以查看我的更新,从dropbox查看该链接。
  2. 您可以在css深度框周围看到红色框。
  3. 它在html页面中运行良好
  4. 我想在WP
  5. 中这样做

    在这里寻求帮助

1 个答案:

答案 0 :(得分:1)

有两种方法可以创建菜单。

  1. 使用get_pages
  2. 使用wordpress菜单功能
  3. <强> NO.1

    <ul>    
    <?php
    $topparentofcurrent = getTopParentPostID($post->ID);
    $alltoppages = get_pages('parent=0&hierarchical=0&sort_column=menu_order&sort_order=ASC');
    foreach($alltoppages as $pages){ ?>
    Your html code here to repeat in loop.
    <li><?php echo $pages->post_title ?></li>
    <?php } ?>    
    </ul>
    

    <强>第2期

    <div id="topMenu">
        <div id="access">
          <?php
                $args = array(
                'theme_location' => 'header_menu',
                'menu' => 'Main Menu',
                 'sort_column' => 'menu_order',
                 'container_class' => 'menu-header'
    
            );
            wp_nav_menu($args);
                ?>
        </div>
      </div>
    

    现在你需要在css中做样式,它只会自动显示父子行为。