【发布时间】:2012-12-05 02:44:16
【问题描述】:
我重新发布了同样的问题,但我最好定义问题。
基本上,我试图限制出现在我的索引页面上的文章数量 - 但是,我似乎设法破坏了我创建的任何 CATEGORY 页面。
例如,如果您转到http://www.invisiblejungle.com,则从“广播节目”类别中提取的“近期帖子”部分显示得很好。
但是,如果您单击导航栏中的 Radio Shows(这是一个类别),它会将侧边栏小部件扔到页面底部,并扭曲每篇单独的文章。
编辑:
我发现问题肯定出在 loop.php 中,当它检索帖子时。
<?php
/**
* The loop for displaying multiple posts (blog, search, categories, tags, etc).
*
* @package WordPress
* @subpackage Debut
* @since Debut 2.0
*
*/
?>
<?php if( have_posts() ) : ?>
<?php
/**
* Page Header
*
*/
locate_template( 'includes/page-header.php', true ); ?>
<?php while( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class( 'entry' ) ?>>
<?php
/**
* Entry Thumbnail
*
*/
locate_template( 'includes/entry-thumbnail.php', true, false ); ?>
<?php
/**
* Entry Header
*
*/
locate_template( 'includes/entry-header.php', true, false ); ?>
<?php
/**
* Entry Content/Summary
*
*/
if ( is_archive() || is_search() ) : // Check if this is an Archives and Search page ?>
<div class="entry-summary">
<?php the_excerpt(); ?>
<a class="more-link" href="<?php the_permalink() ?>" title="<?php c7s_the_title_attribute(); ?>"><?php _e( 'Read More →', 'framework' ); ?></a>
</div><!-- .entry-summary -->
<?php else : // If not Archives or Search page ?>
<div class="entry-content">
<?php global $more; $more = 0; // Needed for more tag to work ?>
<?php the_content( __( 'Read More →', 'framework' ) ); // Show content ?>
<?php do_action( 'get_page_links' ); // Show page links (custom function to wp_link_pages() - functions/theme-helpers.php ?>
</div><!-- .entry-content -->
<?php endif; // End Archive and Search page check ?>
</article><!-- #post-## -->
<?php
/**
* Entry Comments
*
*/
comments_template( '', true ); ?>
<?php endwhile; // end posts loop ?>
<?php else : // If there are not any posts ?>
<?php
/**
* Page Header
*
*/
locate_template( 'includes/page-header.php', true ); ?>
<?php
/**
* Archives
*
*/
get_template_part( 'loop', 'archives' ); ?>
<?php endif; // end loop ?>
<?php
/**
* Pagination
*
*/
if ( $wp_query->max_num_pages > 1 ) : // Check for pages ?>
<div id="nav-below" class="pagenavi">
<?php if ( function_exists( 'wp_pagenavi' ) ) : // Check for WP Page Navi Plugin ?>
<?php wp_pagenavi(); ?>
<?php else : ?>
<div class="nav-previous"><?php next_posts_link( '<span class="meta-nav">←</span>' . __( ' Older posts', 'framework' ) ); ?></div>
<div class="nav-next"><?php previous_posts_link( __( 'Newer posts ', 'framework' ) . '<span class="meta-nav">→</span>' ); ?></div>
<?php endif; // End WP Page Navi plugin check ?>
</div><!-- #nav-below -->
<?php endif; // end page check ?>
</section><!-- #entry-container -->
【问题讨论】:
-
你能列出你的主题文件夹中的文件吗?看来类别页面和搜索页面正在这样做。
-
有几个: Comments (cmets.php) Footer (footer.php) theme-helpers.php theme-metabox.php theme-tinymce.php theme-widgets.php 主题函数(functions.php ) 标头 (header.php) home.php 公告.php archives.php entry-header.php entry-thumbnail.php page-header.php 主索引模板 (index.php) loop-archives.php loop-featured.php 循环-hero.php loop-singular.php loop.php options-announcement.php options-featured.php options-footer.php options-general.php options-hero.php options-instant-view.php options-logo-icons。 php选项-menus.php
-
options-plugins.php options-save-the-web.php options-social-media.php options-thank-you.php options-theme-styles.php options.php 页面模板(页面.php) 搜索表单 (searchform.php) sidebar-footer.php 边栏 (sidebar.php) 单篇文章 (single.php) 档案页面模板 (template-archives.php) 居中页面模板 (template-centered.php) 全宽页面模板 (template-full.php) 自定义帖子页面页面模板 (template-post-page.php) 抱歉,我在 cmets 中没有非常方便的方法来执行此操作...我将其发布在主文件。
标签: php wordpress categories