Wordpress循环不起作用

时间:2014-06-18 14:57:03

标签: php wordpress loops blogs

有谁能告诉我为什么这个wordpress博客一遍又一遍地循环标题和横幅?似乎不是仅仅循环帖子而是循环整个页面。

以下是我博客的链接: http://testing.printlabelandmail.com/blog/

<?php
/**
* The default template for displaying content.
*/
get_header(); ?>

<!-- Start Top Header affix nav-->
<div id="affix" data-spy="affix" data-offset-top="94" data-offset-bottom="0">

<!-- **** START - NAVBAR SCROLLSPY FIX DO NOT REMOVE **** 
<div id="top" class="hide"></div>
<!-- **** END - NAVBAR SCROLLSPY FIX DO NOT REMOVE **** -->

<!-- **** START - NAV **** -->
<nav class="navbar navbar-default navbar-shrink">
<div class="container">
<div class="navbar-header">
<!-- main-logo goes here-->
<h1 class="brand--font"><a href="<?php echo esc_url( home_url( '/' ) ); ?   >">        PRINTLABELANDMAIL.COM</a></h1>
    <button type="button" class="navbar-toggle" data-toggle="collapse" data-    target=".navbar-ex1-collapse">
      <span class="icon-menu"></span>
    </button>
            </div>
<!-- **** START - NAVBAR SCROLLSPY FIX DO NOT REMOVE **** -->
<li class="hide"><a href="#top"></a></li>
<!-- **** END - NAVBAR SCROLLSPY FIX DO NOT REMOVE **** -->
<?php

$defaults = array(
'theme_location'  => '',
'menu'            => 'main-nav',
'container_id'    => 'nav',
'container_class' => 'navbar navbar-default navbar-shrink',
'container'       => 'div',
'container_class' => 'collapse navbar-collapse navbar-ex1-collapse',
'container_id'    => '',
'menu_class'      => 'menu',
'menu_id'         => '',
'echo'            => true,
'fallback_cb'     => 'wp_page_menu',
'before'          => '',
'after'           => '',
'link_before'     => '',
'link_after'      => '',
'items_wrap'      => '<ul class="nav navbar-nav">%3$s</ul>',
'depth'           => 0,
'walker'          => ''
);

wp_nav_menu( $defaults );

?>
        </div>
    </nav><!-- **** END - NAV **** -->
</div><!-- **** END -affix NAV **** -->
<!-- end Top Header affix nav-->

<!-- **** start blog banner **** -->    
<div id="blog-banner">

<?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('blog-banner')) :     else : ?>
<div class="pre-widget">
    <p><strong>Widgetized Area</strong></p>
    <p>This panel is active and ready for you to add some widgets via the WP  Admin</p>
</div>

<?php endif; ?>

</div>
<!-- **** / end blog banner **** -->    

<!-- **** START - BLOG **** -->
<div class="container  blog">
  <div class="row  blog--row">

    <!-- **** START - LEFT CONTENT -->
    <div class="col-lg-8">

      <!-- blog post -->
<!-- blog post -->
<article <?php post_class('box  box--md  blog--post  push--bottom-sml'); ?>>

<?php the_post_thumbnail('thumbnail', array('class' => 'img-responsive push--bottom')); ?>

<h3 class="brand--font-standard"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>

<h5 class="brand--font-light"><?php _e('posted by'); ?> <?php  the_author(); ?></h5>

<ul class="list-inline  tags  blog--tags  push--bottom-tiny">             
<li><?php the_category(',') ?></li>
</ul>

<?php the_content('<p class="section-subtitle"><p class="btn  btn--orange  brand-- font">Read More</p></p>'); ?>

<?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?> 

<?php edit_post_link('Edit', ' &#124; ', ''); ?>
</article>

<div class="row">
        <div class="col-lg-12">
          <!-- pagination -->
<ul class="pagination">
            <li class="disabled  pagination--prev"><a href="#">&lt;</a></li>
            <li class="active"><a href="#">1</a></li>
            <li><a href="#">2</a></li>
            <li class="pagination--next"><a href="#">&gt;</a></li>
          </ul><!-- pagination -->
        </div>
      </div>
<ul class="pagination">
<li class="pagination--prev"><?php previous_post_link('<< %link') ?></li> <li     class="pagination--next"><?php next_post_link(' %link >>') ?></li>
          </ul>
</div><!-- **** END - LEFT CONTENT **** -->

<!-- **** START - RIGHT CONTENT **** -->
    <div class="col-lg-4  right-hand-bar">
<?php get_sidebar(); ?>
</div><!-- **** END - RIGHT CONTENT **** -->
</div>
</div><!-- **** END - BLOG **** -->

1 个答案:

答案 0 :(得分:-1)

是正确的?请仔细检查

  <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('blog-banner')) :     else : ?>

//i think i should be like below:

 <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('blog-banner')) dynamic_sidebar( 'blog-banner' );  else : ?>