首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >doctype定位- wordpress

doctype定位- wordpress
EN

Stack Overflow用户
提问于 2014-11-06 05:45:22
回答 1查看 2.2K关注 0票数 0

所以我有一个通过wordpress创建的网站。我的问题是,doctype是在div之后声明的,我认为是错误的。但是由于我使用wordpress,所以我把doctype标签放在了我的头上,但是我的头在div里面。

标头内容

代码语言:javascript
复制
<div class="row" >
    <?php get_header(); ?> // <-- doctype loads here
        <div id="content">
            <div class="twelve columns clearfix">
                <section class="nine columns clearfix" itemprop="articleBody" style="border-right: 1px solid #a79c7f;  min-height:450px !important;">
                    <?php if ( have_posts() ) : ?>
                    <?php query_posts('category_name=post da');  while ( have_posts() ) : the_post(); ?> 
<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"target="_blank" ><h1><?php the_title(); ?></h1>
                        <?php the_excerpt(); ?></a>
                    <hr>
                    <?php endwhile; ?>
                </section> 
                    <?php if (function_exists('page_navi')) { // if expirimental feature is active ?>
                        <?php page_navi(); // use the page navi function ?>
                    <?php } else { // if it is disabled, display regular wp prev & next links ?>
                        <nav class="wp-prev-next">
                            <ul class="clearfix">
                                <li class="prev-link"><?php next_posts_link(_e('&laquo; Older Entries', "bonestheme")) ?></li>
                                <li class="next-link"><?php previous_posts_link(_e('Newer Entries &raquo;', "bonestheme")) ?></li>
                            </ul>
                        </nav>
                    <?php } ?>      
                    <?php else : ?>
                    <?php endif; ?>
                    <?php get_sidebar(); ?>
            </div> <!-- end #main -->
        </div> <!-- end #content -->
    <?php get_footer(); ?>
</div> <!-- end .row-->

现在我知道这可以通过移除标头中的doctype标记并放在前面来解决。

<div class="row" >

但是把它放在我创建的每个模板上都是多余的。除了把我的doctype放到每个页面之外,我还有什么可以做的吗?就像我在头文件中使用的方式一样,但是顺序正确。

我不能将标题的位置交换到我的行,因为设计会中断。

另一个问题:是否可以从我的页眉启动一个div,而不是将结束标记放置在页眉上,而是将它放在页脚上。那能行吗?因此,我可以将启动div行放在头上doctype标记之后,而不是将其放在整个标题之前。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-11-06 06:12:48

通过将div行放在doctype标记之后的header.php文件中,我已经解决了这个问题。然后删除我在每个模板上声明的所有行。关闭html和body之前,结束标记位于页脚处。我认为现在一切都是固定的。:)

代码语言:javascript
复制
<!doctype html>  
<!--[if IEMobile 7 ]> <html <?php language_attributes(); ?>class="no-js iem7"> <![endif]-->
<!--[if lt IE 7 ]> <html <?php language_attributes(); ?> class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]>    <html <?php language_attributes(); ?> class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]>    <html <?php language_attributes(); ?> class="no-js ie8"> <![endif]-->
<!--[if (gte IE 9)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html <?php language_attributes(); ?> class="no-js"><!--<![endif]-->
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="Hotel Frederiksminde" content="Wordpress Site of Hotel Frederiksminde." />
        <title><?php bloginfo('name'); ?><?php wp_title( '&laquo;', true, 'left'); ?> </title>
        <meta name="description" content="<?php bloginfo('description'); ?>" />             
        <meta name="viewport" content="width=device-width; initial-scale=1.0">
        <!-- icons & favicons -->
        <!-- For iPhone 4 -->
        <link rel="apple-touch-icon-precomposed" sizes="114x114" href="<?php echo get_template_directory_uri(); ?>/library/images/icons/h/apple-touch-icon.png">
        <!-- For iPad 1-->
        <link rel="apple-touch-icon-precomposed" sizes="72x72" href="<?php echo get_template_directory_uri(); ?>/library/images/icons/m/apple-touch-icon.png">
        <!-- For iPhone 3G, iPod Touch and Android -->
        <link rel="apple-touch-icon-precomposed" href="<?php echo get_template_directory_uri(); ?>/library/images/icons/l/apple-touch-icon-precomposed.png">
        <!-- For Nokia -->
        <link rel="shortcut icon" href="<?php echo get_template_directory_uri(); ?>/library/images/icons/l/apple-touch-icon.png">
        <!-- For everything else -->
    <link rel="shortcut icon" type="image/x-icon" href="<?php echo get_template_directory_uri(); ?>/hotelfs.png" /> 
        <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/style.css" type="text/css" />
        <!-- media-queries.js (fallback) -->
        <!--[if lt IE 9]>
            <script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script>           
        <![endif]-->
        <!-- html5.js -->
        <!--[if lt IE 9]>
            <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
        <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>">
        <!-- wordpress head functions -->
        <?php wp_head(); ?>
        <!-- end of wordpress head -->
        <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
        <!-- bring in theme options styles -->
        <?php 
        $heading_typography = of_get_option('heading_typography');
        if ($heading_typography) {
            $theme_options_styles = '
            h1, h2, h3, h4, h5, h6{ 
                font-family: ' . $heading_typography['face'] . '; 
                font-weight: ' . $heading_typography['style'] . '; 
                color: ' . $heading_typography['color'] . '; 
            }';
        }
        $main_body_typography = of_get_option('main_body_typography');
        if ($main_body_typography) {
            $theme_options_styles .= '
            body{ 
                font-family: ' . $main_body_typography['face'] . '; 
                font-weight: ' . $main_body_typography['style'] . '; 
                color: ' . $main_body_typography['color'] . '; 
            }';
        }
        $link_color = of_get_option('link_color');
        if ($link_color) {
            $theme_options_styles .= '
            a{ 
                color: ' . $link_color . '; 
            }';
        }
        $link_hover_color = of_get_option('link_hover_color');
        if ($link_hover_color) {
            $theme_options_styles .= '
            a:hover{ 
                color: ' . $link_hover_color . '; 
            }';
        }
        $link_active_color = of_get_option('link_active_color');
        if ($link_active_color) {
            $theme_options_styles .= '
            a:active{ 
                color: ' . $link_active_color . '; 
            }';
        }
        $topbar_bg_color = of_get_option('top_nav_bg_color');
        if ($topbar_bg_color) {
            $theme_options_styles .= '
            .top-nav { 
                background-color: '. $topbar_bg_color . ';
            }';
        }
        $topbar_link_color = of_get_option('top_nav_link_color');
        if ($topbar_link_color) {
            $theme_options_styles .= '
            .top-nav > li > a { 
                color: '. $topbar_link_color . ' !important;
            }';
        }
        $topbar_link_hover_color = of_get_option('top_nav_link_hover_color');
        if ($topbar_link_hover_color) {
            $theme_options_styles .= '
            .top-nav > li > a:hover { 
                color: '. $topbar_link_hover_color . ' !important;
            }';
        }
        $suppress_comments_message = of_get_option('suppress_comments_message');
        if ($suppress_comments_message){
            $theme_options_styles .= '
            #main article {
                border-bottom: none;
            }';
        }       
        if($theme_options_styles){
            echo '<style>' 
            . $theme_options_styles . '
            </style>';
        }
        ?>  
    <style>
    #glt-translate-trigger {
        background: #9f6330;
        color: #ffffff;
        cursor: pointer;
    }
    .goog-te-combo {
        height: 20px !important;
        top: -5px;
        position: relative;
        font-size: 11px;
    }
    #google_language_translator {
        height: 20px;
        width: 100px;
        float: right;
    }
    .goog-te-gadget .goog-te-combo {
        margin: 4px 0;
        width: 100px !important;
    }
    @media only screen and (max-width: 874px) {
    .goog-te-gadget .goog-te-combo {
        display:none;
    }
    }
    @media only screen and (max-width: 844px) {
    #glt-translate-trigger {
        height: 10px;
        font-size: 10px ;
        }
    }

    </style>
    </head>
    <body <?php body_class(); ?>>

<div class="row" > // DIV STARTS HERE
            <header role="banner" id="top-header">
        <div class="twelve columns" style="background: transparent; padding:0px !important;" >  
            <section class="twelve columns text-center" style="background: transparent;">
                <a href="http://fabioide.com/frederiksminde/velkommen"><img src="http://fabioide.com/frederiksminde/wp-content/uploads/2014/09/fredlogo.png" alt="Hotel Frederiksminde Logo" style="height:100px; width:410px;"></a>
            </section>

            <section class="twelve columns text-center" style="background: transparent;padding:0px !important;  ">
                <div class="menuimg">
                <img src="http://fabioide.com/frederiksminde/wp-content/uploads/2014/10/menu.jpg" style="width:30px; height:30px;" alt="Mobile Menu" >
                </div>

<div id="navcontainer"> 
                <?php // Navigation that display all pages. ?>
                <?php // wp_nav_menu( array( 'sort_column' => 'menu_order', 'container' => false, 'theme_location' => 'The Main Menu Dansk', 'exclude' => '479' ) ); ?>

                    <?php  if ( is_active_sidebar( 'sidebar2' ) ) : ?>
                <?php  dynamic_sidebar( 'sidebar2' ); ?>
                    <?php  else : ?>
                <!-- This content shows up if there are no widgets defined in the backend. -->
                    <div class="alert-box">Please activate some Widgets.</div>
            <?php  endif; ?>

            </section>
        </div>
        <div class="twelve columns" style="background: transparent; padding:0px;" >  
            <div class="slider">
            <?php masterslider(1); ?>
            </div>
                </header> <!-- end header -->   
票数 -3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26772512

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档