【问题标题】:Move featured area to archive page in canard wordpress theme将特色区域移动到 canard wordpress 主题中的存档页面
【发布时间】:2016-12-29 08:45:48
【问题描述】:

我正在为 wordpress 博客使用 canard 主题,它在特色内容区域显示热门帖子。
我的博客上有一些类别,这里是blog 的链接

在类别列表 (archive.php) 页面上使用精选内容区域,该类别的所有热门帖子都应出现在 featured content area 中。

我试图编辑我的存档页面,但我猜有些 css 无法正常工作,我无法找出我哪里出错了

   <?php
    /**
    * The template for displaying archive pages.
    *
    * Learn more: http://codex.wordpress.org/Template_Hierarchy
    *
    * @package Canard
    */

 get_header(); ?>

<div class="site-content-inner">
    <div id="primary" class="content-area">
     <?php 
       if ( is_archive() ) {
          get_template_part( 'featured-content','archive' );
     }?>
        <main id="main" class="site-main" role="main">

        <?php if ( have_posts() ) : ?>

            <header class="page-header">
                <?php
                    the_archive_title( '<h1 class="page-title">', '</h1>' );
                    the_archive_description( '<div class="taxonomy-description">', '</div>' );
                ?>
            </header><!-- .page-header -->

            <?php /* Start the Loop */ ?>
            <?php while ( have_posts() ) : the_post(); ?>

                <?php
                    /* Include the Post-Format-specific template for the content.
                     * If you want to override this in a child theme, then include a file
                     * called content-___.php (where ___ is the Post Format name) and that will be used instead.
                     */
                    get_template_part( 'content', get_post_format() );
                ?>

            <?php endwhile; ?>

            <?php the_posts_navigation(); ?>

        <?php else : ?>

            <?php get_template_part( 'content', 'none' ); ?>

        <?php endif; ?>

        </main><!-- #main -->
    </div><!-- #primary -->

    <?php get_sidebar(); ?>
   </div><!-- .site-content-inner -->

   <?php get_footer(); ?>

【问题讨论】:

  • 我们无法查看 CSS 遗漏的地方。您能否提供一些相同的屏幕截图?

标签: php css wordpress


【解决方案1】:

我已经检查过博客页面不是从这个存档页面编码的。它不包含博客页面的所有部分。博客页面来自其他文件。

您可以从特色属性中删除帖子,因此它只会显示简单的帖子。如果您选择帖子作为特色,它们会显示在顶部。如果没有特色帖子,则不会在顶部显示为网格。

谢谢希望这对你有帮助。

【讨论】:

    猜你喜欢
    • 2014-10-07
    • 2017-05-27
    • 1970-01-01
    • 2017-04-10
    • 1970-01-01
    • 1970-01-01
    • 2011-08-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多