Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Show the categories although post has only one category #80

Closed
wants to merge 1 commit into from

3 participants

@amyunus

I have downloaded _s theme and found that theme does not show the category. I'm trying to show the categories after modifying this code.

@amyunus amyunus Show the categories
Show the categories although post only has one categories
26adc9b
@ashfame

This is how it is done in _s explicitly i.e. show categories in meta text only when there are more than 1 categories. The function _s_categorized_blog() checks whether the post has a single category. But I don't understand why it is like that?

@ashfame

IMO, such sort of logic shouldn't be present in a starter theme. Simple line which outputs category, tags etc is enough to indicate what functions to use. Thoughts?

@kovshenin
Owner

I like the current approach, as well as the one that hides the author when the blog is a single-author blog, it hides the "posted by admin" and "filed under Uncategorized" for many people. I think it's a great addition to the starter theme, and I don't think we should get rid of it.

Also, "Show the categories although post has only one category" doesn't sound right, because if there are at least two categories in the whole blog, all the posts (including ones with only one category) will show the categories meta.

@amyunus

Oh, I see. thanks for explanation @kovshenin. I should cancel my pull request then :)
Anyway I just know that actually something weird with my wp installed on my localhost. all of the post have category beside uncategorized. but when I visit wp-admin/edit-tags.php?taxonomy=category, all of categories except uncategorized valued 0. http://i.imgur.com/mXjpE.jpg

@amyunus amyunus closed this
@kovshenin
Owner

@amyunus you can use something like wp_update_term_count http://core.trac.wordpress.org/browser/tags/3.4.2/wp-includes/taxonomy.php#L2435 to reset terms counts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 15, 2012
  1. @amyunus

    Show the categories

    amyunus authored
    Show the categories although post only has one categories
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 3 deletions.
  1. +2 −2 content-single.php
  2. +1 −1  content.php
View
4 content-single.php
@@ -30,9 +30,9 @@
if ( ! _s_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>.', '_s' );
+ $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>.', '_s' );
} else {
- $meta_text = __( 'Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', '_s' );
+ $meta_text = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', '_s' );
}
} else {
View
2  content.php
@@ -32,7 +32,7 @@
<?php
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list( __( ', ', '_s' ) );
- if ( $categories_list && _s_categorized_blog() ) :
+ if ( $categories_list ) :
?>
<span class="cat-links">
<?php printf( __( 'Posted in %1$s', '_s' ), $categories_list ); ?>
Something went wrong with that request. Please try again.