WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#14161 closed enhancement (fixed)

Taxonomy Titles

Reported by: ramiy Owned by:
Milestone: 3.1 Priority: low
Severity: normal Version: 3.0
Component: Template Keywords: has-patch
Focuses: Cc:

Description

in category.php we use the category_description() and single_cat_title() functions.

in tag.php we use the tag_description() and single_tag_title() functions.

in taxonomy.php we use term_description() function BUT the is no title function.

Attachments (2)

14161.patch (3.0 KB) - added by ramiy 7 years ago.
single_term_title() function
14161.2.patch (6.6 KB) - added by scribu 7 years ago.
cleaned up wp_title(), single_cat_title() & single_tag_title()

Download all attachments as: .zip

Change History (26)

#1 @markmcwilliams
7 years ago

Wouldn't it be a lot easier, and simplier to just have term_description() and single_term_title() if anything and an option to state which (if any) term we are talking about? :) It would make a lot more logic to me...!

#2 follow-up: @nacin
7 years ago

Indeed, term_description() is used by both category_ and tag_.

#3 in reply to: ↑ 2 @markmcwilliams
7 years ago

Replying to nacin:

Indeed, term_description() is used by both category_ and tag_.

On a closer inspection (well actually I found the right PHP file to look at) I can see that they both use term_description() like you say!

#4 @ramiy
7 years ago

Yes, both category_description() and tag_description() use the main term_description() function. I think cat/tag functions were not deleted for backwards compatibility.

We need to do the same with single_term_title().

#5 @scribu
7 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release
  • Priority changed from normal to low
  • Severity changed from major to normal

#6 @kevinB
7 years ago

  • Cc kevinB added

@ramiy
7 years ago

single_term_title() function

#7 @ramiy
7 years ago

  • Keywords has-patch dev-feedback added; needs-patch removed

#8 follow-up: @scribu
7 years ago

ramiy, your patch introduces single_term_title(), but it doesn't use it anywhere in Core, like in single_tag_title().

#9 in reply to: ↑ 8 @ramiy
7 years ago

Replying to scribu:

ramiy, your patch introduces single_term_title(), but it doesn't use it anywhere in Core, like in single_tag_title().

WP v3.0 introduced taxonomy-{taxonomy}-{term}.php template file. i need it for my theme to show the taxonomy title.

We can add the taxonomy.php file to "Twenty Ten" theme for better suport of custom taxonomies.

#10 follow-up: @scribu
7 years ago

  • Keywords changed from has-patch, dev-feedback to has-patch dev-feedback

No, I thought single_term_title() could be used in single_tag_title(), in the same way term_description() is used in tag_description().

#11 in reply to: ↑ 10 @ramiy
7 years ago

scribu, i think you right, but i will need your help with the code.

#12 @ramiy
7 years ago

scribu, see also the wp_title() function. it uses single_cat_title() and single_tag_title(). we need to insert the new single_term_title() to wp_title() when taxonomy archive is being used.

#13 @scribu
7 years ago

  • Component changed from Taxonomy to Template
  • Keywords dev-feedback removed
  • Milestone changed from Future Release to 3.1

No, I thought single_term_title() could be used in single_tag_title(), in the same way term_description() is used in tag_description().

scribu, see also the wp_title() function. it uses single_cat_title() and single_tag_title(). we need to insert the new single_term_title() to wp_title() when taxonomy archive is being used.

Done and done. See 14161.2.patch

@scribu
7 years ago

cleaned up wp_title(), single_cat_title() & single_tag_title()

#14 @ramiy
7 years ago

looks good.

#15 @ramiy
7 years ago

wp 3.1 is planned for late 2010/early 2011. can you change the milestone to 3.0.1 ?

#16 @scribu
7 years ago

WP 3.0.1 is only for security fixes or blockers (bugs that would have blocked 3.0 from shipping, if they were known).

#17 @ramiy
7 years ago

But without the single_term_title() function we can't insert titles to taxonomy.php tamplate file (or to archive.php).

We forgot to deal this issue in v3.0 and users that use custom taxonomies can't wait another 6 monts for v3.1, especially when there is a working solution.

Please, add this to 3.0.1.

#18 @scribu
7 years ago

Support for custom taxonomies was introduced way back in WP 2.8 and I haven't heard any complaints about a lack of single_term_title() until this ticket.

Anyway, until WP 3.1, users can just add this to their functions.php file:

if ( !function_exists('single_term_title') ) :
function single_term_title(...) {
   ...
}

#19 @scribu
7 years ago

Forgot an endif; at the end.

#20 follow-up: @ramiy
7 years ago

taxonomy.php tamplate files where introduced in WP 3.0.

#21 in reply to: ↑ 20 @nacin
7 years ago

Replying to ramiy:

Please, add this to 3.0.1.

That's not how it works.

Replying to ramiy:

taxonomy.php tamplate files where introduced in WP 3.0.

They were introduced in 2.5.

#22 @ramiy
7 years ago

ok. 3.1 it is.

#23 @scribu
7 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [15598]) Clean up single_cat_title(), single_tag_title() and wp_title(). Fixes #14161

#24 @scribu
7 years ago

(In [15599]) Replace is_term() with is_tax(). See #14161

Note: See TracTickets for help on using tickets.