开发者

WordPress - Missing SideBar and Footer

开发者 https://www.devze.com 2023-03-27 00:05 出处:网络
Excuse my ignorance, I am very new to the web scene. I am missing a sidebar and footer on my custom theme. I was able to get the background images to appear for the header and content, but not for the

Excuse my ignorance, I am very new to the web scene. I am missing a sidebar and footer on my custom theme. I was able to get the background images to appear for the header and content, but not for the footer and sidebar. I have followed several tutorials, researched to both ends of the internet and cannot figure out what I am doing wrong.

I am attempting to create a layout that consists of a header, content and right sidebar. I really don't want anything in my side bar from WordPress. I am going to put the site navigation and login there, but I would like the background to show up! I will post the basic code below and give the link to my site here. Thanks in advance!

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开发者_StackOverflow://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%;
}


You have applied background on the content but nothing is there for the footer.

You can either change to styling of the footer in your css, or you can put

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

</div>

in #container too. Then, it would all be included in the same div and the background would apply too.

Similarly, you can include the sidebar like that, in the container only.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号