有人能告诉我为什么wordpress的博客会反复循环标题和横幅吗?似乎不仅仅是循环帖子,而是循环整个页面。此代码在我的内容中。php文件。任何帮助都将不胜感激。
以下是我的博客链接: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 »\', \'1 Comment »\', \'% Comments »\'); ?>
<?php edit_post_link(\'Edit\', \' | \', \'\'); ?>
</article>
<div class="row">
<div class="col-lg-12">
<!-- pagination -->
<ul class="pagination">
<li class="disabled pagination--prev"><a href="#"><</a></li>
<li class="active"><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li class="pagination--next"><a href="#">></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 **** -->
最合适的回答,由SO网友:eyoung100 整理而成
自定义标题。php
<!-- 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 **** -->
含量。php
<?php
/**
* The default template for displaying content.
*/
get_header(\'custom-header\'); ?>
<!-- **** START - BLOG **** -->
<div class="container blog">
<div class="row blog--row">
<!-- **** START - LEFT CONTENT -->
....
<!-- **** END - LEFT CONTENT **** -->
....
我还建议将侧边栏放在名为left sidebar的文件中。php和右侧边栏。php和自定义页脚中的页脚。php。这里的目的是将版面与内容分开。
理想的布局是:
获取页眉(左)-可选的文章内容(右)-可选的按顺序获取页脚(右)。因此,内容。php只包含文章内容和布局。
欢迎使用WordPress。东南部。不错的设计顺便说一句。。。
- get_header() Function Reference
- get_footer() Function Reference
- get_sidebar() Function Reference