所以我有一个通过wordpress创建的网站。我的问题是doctype是在div之后声明的,我认为这是错误的。但由于我正在使用wordpress,我将doctype标记放在我的标题上,但我的标题位于div内。
<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('« Older Entries', "bonestheme")) ?></li>
<li class="next-link"><?php previous_posts_link(_e('Newer Entries »', "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而不是将结束标记放在标题中,而是将其放在页脚上。那会有用吗?所以我可以在标题上的doctype标记之后放置起始div行,而不是将它放在整个标题之前。
答案 0 :(得分:-3)
我已经通过在doctype标记之后将header行放在header.php文件中来解决了这个问题。 然后删除我在每个模板上声明的所有行。在html和body关闭之前,结束标记位于页脚。一切都是固定的,我想现在。 :)
<!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( '«', 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 -->