Condence code and add custom taxonomy support for archive descriptions. #128

Closed
wants to merge 3 commits into
from

Conversation

Projects
None yet
4 participants

wpdevco commented Dec 30, 2012

Any reason term_description() isn't preferred?

Contributor

mfields commented Jan 1, 2013

  • I think that moving to term_description() makes sense here.
  • term_description() should probably only be called if is_category(), is_tag(), or is_tax() returns true.
  • The html element containing the description should not contain the class entry-content. This is reserved for post objects. I think the best class name to use here would be term-description.
  • There is no need to use parens with the echo construct.
  • Your patch removed the tag_archive_meta and category_archive_meta filters from the theme. I'm OK with this, but I'm not sure how everyone else feels about these. I think they are out of place -> It's rare that we allow html to be filtered in this manner. IMHO the filters provided by sanitize_term_field() in core should be enough to modify the output of the term description.

wpdevco commented Jan 1, 2013

Updated everything except sanitize_term_field(). To be perfectly honest, not sure how that would work.

Contributor

mfields commented Jan 1, 2013

Cool! RE: sanitize_term_field() this was not something that needed to be included. I was mainly pointing out that the current filters in _s are not really necessary because there is a core-supported way to modify the output of term_description().

@obenland obenland commented on the diff Jan 19, 2013

archive.php
- // show an optional category description
- $category_description = category_description();
- if ( ! empty( $category_description ) )
- echo apply_filters( 'category_archive_meta', '<div class="taxonomy-description">' . $category_description . '</div>' );
-
- } elseif ( is_tag() ) {
- // show an optional tag description
- $tag_description = tag_description();
- if ( ! empty( $tag_description ) )
- echo apply_filters( 'tag_archive_meta', '<div class="taxonomy-description">' . $tag_description . '</div>' );
- }
+ // show optional term description
+ if ( is_category() || is_tag() || is_tax() )
+ $term_description = term_description();
+ if ( ! empty( $term_description ) )
+ echo '<div class="term-description">' . $term_description . '</div>';
@obenland

obenland Jan 19, 2013

Member

The if ( is_category() || is_tag() || is_tax() ) should be wrapped in {} (or use the if: endif; syntax), as indentation suggests.
Currently we'd run into an undefined variable notice.

Contributor

mfields commented Feb 27, 2013

I'm going to work on this one next.

Member

obenland commented Mar 26, 2013

@mfields Any news here?

Contributor

ianstewart commented Jun 26, 2013

This still seems like a good idea. :)

obenland closed this in 3a5afef Jun 27, 2013

@ryelle ryelle added a commit to ryelle/flounder that referenced this pull request Dec 2, 2013

@ryelle ryelle Add custom taxonomy support for term descriptions in taxonomy abe12f2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment