Wordpress问题与页脚

时间:2012-09-04 09:26:01

标签: wordpress footer

我一直在努力将我简单的html / css网站变成一个wordpress网站。在我的页脚中出现了一个似乎无法解决的重大问题。页脚几乎忽略了所有内容,只是停留在网站的顶部(就像它是我标题的一部分)。我的所有文件都分成3个文件。 header.php是footer.php和page.php(每个站点一个)。

标题!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>

    <head profile="http://gmpg.org/xfn/11">

        <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

        <?php if (is_search()) { ?>
           <meta name="robots" content="noindex, nofollow" /> 
        <?php } ?>

        <title>
               <?php
                  if (function_exists('is_tag') && is_tag()) {
                     single_tag_title("Tag Archive for &quot;"); echo '&quot; - '; }
                  elseif (is_archive()) {
                     wp_title(''); echo ' Archive - '; }
                  elseif (is_search()) {
                     echo 'Search for &quot;'.wp_specialchars($s).'&quot; - '; }
                  elseif (!(is_404()) && (is_single()) || (is_page())) {
                     wp_title(''); echo ' - '; }
                  elseif (is_404()) {
                     echo 'Not Found - '; }
                  if (is_home()) {
                     bloginfo('name'); echo ' - '; bloginfo('description'); }
                  else {
                      bloginfo('name'); }
                  if ($paged>1) {
                     echo ' - page '. $paged; }
               ?>
        </title>

        <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />

        <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" />

        <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />

        <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>


        <?php wp_head(); ?>

    </head>

    <body <?php body_class(); ?>>


                        <div id="Menu" ></div>
                                            <div id="Mainbody">
                                                    <div id="Portfolio"><a href="<?php echo get_option('home'); ?>"><?php bloginfo('name'); ?></a> </div>
                                                    <div id="Slogan"><a href="index.html"><?php bloginfo('description'); ?></a></div>
                                                                            <div id="nav-menu">
                                                                                        <?php $defaults = array(
        'theme_location'  => '',
        'menu'            => '', 
        'container'       => 'div', 
        'container_class' => 'menu-{menu slug}-container', 
        'container_id'    => '',
        'menu_class'      => 'menu', 
        'menu_id'         => '',
        'echo'            => true,
        'fallback_cb'     => 'wp_page_menu',
        'before'          => '',
        'after'           => '',
        'link_before'     => '',
        'link_after'      => '',
        'items_wrap'      => '<ul id="%1$s" class="%2$s">%3$s</ul>',
        'depth'           => 0,
        'walker'          => ''
        ); ?>

    <?php wp_nav_menu( $defaults ); ?>
                                                                                </div>
                                                   <div class="Box"> 
                                                            <div id="Mainindhold">

页!

  <?php get_header(); ?>

    <div id="Arbejde">  

                        <h2>Uddrag af mine webdesigns</h2>
                        <br />
                        <br />

                        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                       <?php $key='link'; $custom = get_post_meta($post->ID, $key, true); ?>
                       <?php $key2='brugt'; $custom2 = get_post_meta($post->ID, $key2, true); ?>
                       <?php $key3='linkexternal'; $custom3 = get_post_meta($post->ID, $key3, true); ?>
                       <?php $billede = get_the_post_thumbnail($post->ID, 'full'); ?>


     <div class="Raekke">
        <div class="Arbejds_Billede">
                            <a href="<?php echo $custom; ?>"  rel="lightbox">
                            <?php print $billede; ?></a>
        </div>  
                        <div class="Arbejdsbeskrivelse">
                        <h3><?php the_title(); ?></h3>
                        <?php the_content(); ?>
                                    <div id="program">
                                    <img src="<?php echo $custom2; ?>" />
                                    </div>
                                        <div class="Knap"><a href="<?php echo $custom3; ?>"><p>Besøg siden</p></a>
                                        </div>
                                    </div>



     </div>
     <div class="clear"></div>
                <?php endwhile;
                else:
                ?>
                <?php _e('No posts were fond. Sorry!'); ?>
                <?php endif; ?>



    </div>

    <?php get_footer();?>

页脚!

</div>
        </div>
        </div>

        <div id="footer">
                &copy;<?php echo date("Y"); echo " "; bloginfo('name'); ?> 4000 Roskilde
            </div>


           <script type="text/javascript">

      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-31920214-1']);
      _gaq.push(['_trackPageview']);

      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();

    </script>

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

    </html>

为了能够看到这个问题,你可以进入Tinajohnson.dk,然后在顶部查看。

3 个答案:

答案 0 :(得分:0)

您在页面中调用了两次页脚功能:首先在这里:

<?php get_footer();?>

而且又来了,

<div id="footer">
                &copy;<?php echo date("Y"); echo " "; bloginfo('name'); ?> 4000 Roskilde
            </div>

摆脱第二块它应该有用。

答案 1 :(得分:0)

这是一个CSS问题;将以下规则添加到#footer的CSS:

position: absolute;
bottom: 0;
width: 100%;

答案 2 :(得分:0)

如果您希望自己坚持使用浏览器的底部。使用位置固定不是绝对的 css将用于您的ID页脚Div

#footer { position:fixed; bottom:0; width:100%}