0

2012 の category.php テンプレートに基づくカテゴリ テンプレートのスタイルを設定しようとしています。

以下を適切に修正したと思いますが、ヘッダーのみが表示され、コンテンツは表示されません。行がありませんか?

<?php get_header(); ?>

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

            <header class="page-header">
                <h1 class="page-title"><?php
                    printf( __( 'Category Archives: %s', 'D-Theme' ), '<span>' . single_cat_title( '', false ) . '</span>' );
                ?></h1>

                <?php
                    $category_description = category_description();
                    if ( ! empty( $category_description ) )
                        echo apply_filters( 'category_archive_meta', '<div class="category-archive-meta">' . $category_description . '</div>' );
                ?>
            </header>


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

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

            <?php endwhile; ?>


        <?php else : ?>

            <article id="post-0" class="post no-results not-found">
                <header class="entry-header">
                    <h1 class="entry-title"><?php _e( 'Nothing Found', 'D-Theme' ); ?></h1>
                </header><!-- .entry-header -->

                <div class="entry-content">
                    <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'D-Theme' ); ?></p>
                    <?php get_search_form(); ?>
                </div><!-- .entry-content -->
            </article><!-- #post-0 -->

        <?php endif; ?>

        </div><!-- #content -->
    </section><!-- #primary -->

いつものように助けていただければ幸いです

4

2 に答える 2

0

上記の回答に貢献すると思いました。これをコーディングして、カテゴリを日付、投稿者、投稿時刻とともに表示し、問題のカテゴリのタイトルを表示するメイン タイトルを付けました。

これが生成するコードとスクリーンショットを参照してください。これが役立つことを願っています:)

<?php get_header(); ?>
<div id="maincontentwrap" role="main">
<h1 class="page-title"><?php
printf( __( 'Category Archives: %s', 'D-Theme' ), '<span>' . single_cat_title( '', false ) . '</span>' );
                ?></h1>
<div class="pagedivider"></div>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h1><?php the_title(); ?></h1>
<?php the_content(); ?>
Written by <?php the_author_posts_link() ?> in <?php the_category(); ?> at <?php the_time('H:h a'); ?> 
<div class="pagedivider"></div>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
</div>
<?php get_footer(); ?>

ここに画像の説明を入力

于 2012-12-19T10:27:41.713 に答える
0

投稿の内容を表示したい場合the_content()は、wordpress ループで使用する必要があります。 http://codex.wordpress.org/Function_Reference/the_content

于 2012-12-18T22:51:25.733 に答える