在现有菜单中添加用户登录字段窗体



接上一篇关于在菜单栏中心创建登录字段表单的文章:菜单栏中的"登录/注销"字段不正确且不起作用(Wordpress)

这是我的header.php(主题股票)

    <!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!-->
<?php global $smof_data; ?>
<html <?php language_attributes(); ?> <?php if($smof_data['rnr_enable_rtl_layout'] == true) { echo 'dir="rtl"'; } ?>> <!--<![endif]-->
<!--
===========================================================================
 Jarvis Onepage Parallax WordPress Theme by rocknrolladesigns.com (http://www.rocknrolladesigns.com) 
===========================================================================
-->
<head>
<meta http-equiv="Content-type" content="text/html; charset=<?php bloginfo('charset'); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="x-ua-compatible" content="IE=edge" />
<!-- PAGE TITLE -->
<?php if (defined('WPSEO_VERSION')) { ?>
           <title><?php wp_title(); ?></title>   
<?php }else {
          $rnr_description =  get_bloginfo('description'); ?>
          <title><?php wp_title(' &raquo; ', true, 'right'); ?><?php bloginfo('name'); ?> &raquo; <?php echo $rnr_description; ?></title>
         <meta name="description" content="<?php  echo $rnr_description; ?>">  
         <?php    } ?>
</title>


<!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

<!-- Mobile Specific Metas & Favicons
========================================================= -->
<?php if($smof_data['rnr_favicon_url'] != "") { ?><link rel="shortcut icon" href="<?php echo $smof_data['rnr_favicon_url']; ?>"><?php } ?>

<!-- WordPress Stuff
========================================================= -->
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    <!-- Google Web Fonts -->
 <?php get_template_part( 'includes/googlefonts'); ?>
<?php wp_head(); ?>
</head>
<body <?php body_class('onepage'); ?> data-spy="scroll" data-target=".navigation" data-offset="82">
<div id="load"></div>

     <!-- START PAGE WRAP -->    
    <div class="page-wrap <?php if($smof_data['rnr_enable_dark_skin'] == true) { echo 'dark-skin'; } ?>">
  <!-- HEADER SECTION -->

答案不在头文件中,或者至少不在粘贴的部分中。检查html,顶部导航栏包含在id为undefined-sticky-wrapper的div中的<nav>中。您需要在此<nav>中输出登录表单,然后使用css将其放置在中心。

<!-- START NAVIGATION -->
<div style="height: 81px;" class="main-menu-wrapper" id="undefined-sticky-wrapper"><nav class="page_scroll navigation dark sticky-nav"><!-- START CONTAINER --><div class="container clearfix">         
          <div class="four columns">            
              <!-- START LOGO -->   
              <div class="logo large">
                                        <a href="#" class="back-to-top"><img src="https://cypherbeats.com/wp-content/uploads/2015/12/cypherlogooffwhitec3.png" alt="Cypher | Music Production Company"></a>
                                  </div>
              <!-- END LOGO --> 
              <div class="wpml-mobile">
               </div>       
          </div><!-- END FOUR COLUMNS -->                
           <!-- BEGIN NAVIGATION SECTION --> 
          <div class="twelve columns">                  
              <!-- START NAVIGATION MENU ITEMS -->
              <ul id="nav" class="main-menu large nav sf-menu sf-js-enabled"><li id="menu-item-251" class="menu-item menu-item-type-post_type menu-item-object-page"><a href="#home"><span>Home</span></a></li><li id="menu-item-369" class="menu-item menu-item-type-post_type menu-item-object-page active"><a href="#blog-section"><span>Blog</span></a></li><li id="menu-item-604" class="menu-item menu-item-type-post_type menu-item-object-page"><a href="#info"><span>INFO</span></a></li><li id="menu-item-347" class="menu-item menu-item-type-post_type menu-item-object-page"><a href="#submit"><span>Submit</span></a></li><li id="menu-item-275" class="menu-item menu-item-type-post_type menu-item-object-page"><a href="#contact"><span>Support</span></a></li></ul><select class="selectnav" id="selectnav1"><option value="https://cypherbeats.com/#home">Home</option><option value="https://cypherbeats.com/#blog-section">Blog</option><option value="https://cypherbeats.com/#info">INFO</option><option value="https://cypherbeats.com/#submit">Submit</option><option value="https://cypherbeats.com/#contact">Support</option></select><!-- END NAVIGATION MENU ITEMS --><div class="wpml-desktop">
               </div>           
          </div><!-- END TWELVE COLUMNS --> 
      </div><!-- END CONTAINER -->  
    </nav></div>
<!-- END NAVIGATION -->

因此,您的第一项工作是找出这些div在代码中的输出位置,并找到一个可以用于挂接自己的代码的过滤器或操作。或者,如果html是由模板输出的,您可以覆盖并修改它。

最新更新