当有1个帖子时,类别不显示

时间:2013-08-01 02:39:44

标签: php html wordpress

我现在有一个奇怪的问题。

我刚刚在我的WordPRess博客上发布了我的第一篇博文,由于某种原因,类别列表没有显示。

我发布了另一篇文章来测试它,然后类别开始显示为两个帖子。所以我觉得奇迹已经发生了。

所以,我删除了测试帖(回到一个帖子),然后问题再次开始。没有类别列表。

我很难过,因为代码似乎是合理的,为什么发布另一篇帖子会使类别列表有效?

您可以点击[此处] {http://www.noellesnotes.com}访问该网站,查看我遇到的问题。

我想我发现了这个问题。它在下面的代码中:

<?php
            /* translators: used between list items, there is a space after the comma */
            $category_list = get_the_category_list( __( ', ', 'ribbons-and-clouds' ) );

            /* translators: used between list items, there is a space after the comma */
            $tag_list = get_the_tag_list( '', __( ', ', 'ribbons-and-clouds' ) );

            if ( ! ribbons_and_clouds_categorized_blog() ) {
                // This blog only has 1 category so we just need to worry about tags in the meta text
                if ( '' != $tag_list ) {
                    $meta_text = __( 'This entry was tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'ribbons-and-clouds' );
                } else {
                    $meta_text = __( 'Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'ribbons-and-clouds' );
                }

            } else {
                // But this blog has loads of categories so we should probably display them here
                if ( '' != $tag_list ) {
                    $meta_text = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'ribbons-and-clouds' );
                } else {
                    $meta_text = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'ribbons-and-clouds' );
                }

            } // end check for categories on this blog

            printf(
                $meta_text,
                $category_list,
                $tag_list,
                get_permalink(),
                the_title_attribute( 'echo=0' )
            );
        ?>

如果只有一个,那么看一个if语句如何告诉它不要列出类别?

是否有人知道如何编辑此代码以使类别无论如何显示?

1 个答案:

答案 0 :(得分:0)

看起来很好,也许是一个主题问题?尝试另一个主题,看看它是否会起作用

相关问题