WordPress - 缺少边栏和页脚

时间:2011-08-11 05:48:16

标签: php html css wordpress

请原谅我的无知,我是网络界的新手。我错过了自定义主题的侧边栏和页脚。我能够为标题和内容显示背景图像,但不能显示页脚和侧边栏。我已经学过几个教程,研究了互联网的两端,无法弄清楚我做错了什么。

我正在尝试创建一个包含标题,内容和右侧边栏的布局。我真的不想在WordPress旁边的任何东西。我要把网站导航并登录,但我想要显示背景!我将在下面发布基本代码并提供指向我的网站here的链接。提前致谢!

的index.php

    <div id="container">
        <div id="content" role="main">

        <?php
        /* Run the loop to output the posts.
         * If you want to overload this in a child theme then include a file
         * called loop-index.php and that will be used instead.
         */
         get_template_part( 'loop', 'index' );
        ?>
        </div><!-- #content -->
    </div><!-- #container -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

的header.php

<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<title><?php
/*
 * Print the <title> tag based on what is being viewed.
 */
global $page, $paged;

wp_title( '|', true, 'right' );

// Add the blog name.
bloginfo( 'name' );

// Add the blog description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
    echo " | $site_description";

// Add a page number if necessary:
if ( $paged >= 2 || $page >= 2 )
    echo ' | ' . sprintf( __( 'Page %s', 'twentyten' ), max( $paged, $page ) );

?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('stylesheet_url');?>" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<?php

if ( is_singular() && get_option( 'thread_comments' ) )
    wp_enqueue_script( 'comment-reply' );

    wp_head();
?>
</head>

<body <?php body_class(); ?>>
<div id="wrapper" class="hfeed">
<div id="header">
    <div id="masthead">
             .......
    </div><!-- #masthead -->
</div><!-- #header -->

<div id="main">

的sidebar.php

<div id= "sidebar" class="widget-area" role="complementary">

</div><!-- #sidebar -->

footer.php

</div><!-- #main -->

<div id="footer" role="contentinfo">

</div><!-- #footer -->

</div><!-- #wrapper -->

<?php wp_footer(); ?>
</body>
</html>

的style.css

/*
Theme Name: Mod Theme
Theme URI: http://www.itssimplydesign.com/wordpress/wp-content/themes/mod_theme/
Description: My First Theme
Version: 1.0
Author: Jason
Author URl: http://www.itssimplydesign.com
*/

/* =Layout
-------------------------------------------------------------- */

/*
LAYOUT: Header, Content and Sidebar
DESCRIPTION:
*/

body {
background-color: #e6e9Df;
}

#container {
float: left;
margin: 0 -240px 0 0;
width: 100%;
}

#header {
background: url(http://www.itssimplydesign.com/wordpress/wp-content/themes/mod_theme/images/background_main_01.png) no-repeat;
width: 1000px;
height: 332px;

}

#sidebar {
background: url(http://www.itssimplydesign.com/wordpress/wp-content/themes/mod_theme/images/background_main_03.png) no-repeat;
float: right;
clear: right;
overflow: hidden;
width: 300px;
}

#content {
background: url(http://www.itssimplydesign.com/wordpress/wp-content/themes/mod_theme/images /background_main_02.png) no-repeat;
min-height: 668px;
width: 700px;
float: left;
}

#footer {
clear: both;
width: 100%;
}

1 个答案:

答案 0 :(得分:0)

您已对内容应用了背景,但页脚没有任何内容。

您可以更改css中页脚的样式,也可以添加

<div id="footer" role="contentinfo">

</div>

也在#container中。然后,它将全部包含在同一个div中,背景也适用。

同样,您可以在容器中包含类似的侧边栏。