Opened 16 years ago
Closed 11 years ago
#9719 closed feature request (duplicate)
Please : a filter for $category object in get_the_category_list()
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | 2.8 |
Component: | Template | Keywords: | needs-patch |
Focuses: | Cc: |
Description
To offer for one post more flexibility in how to display the names of categories in the_category() or in get_the_category_list() -file category-template line 166 - , is it possible to add a filter as the filter existing in wp_list_categories() . Useful to replace cat name by instance by image (iphone compatible theme) or to add translation in bilingual or multilingual theme (by instance with xili-language plugin) without re-creating specific function.
As in classes.php (line 1328), I suggest this modif with a filter named post_list_cats for the start of two loops present in get_the_category_list() (line 187 et 209)
foreach ( $categories as $category ) { $cat_name = attr( $category->name); $cat_name = apply_filters( 'post_list_cats', $cat_name, $category );
and inside the two loops, $category->cat_name replaced by $cat_name
with this filter it will be more coherent to treate cat list in one post or in sidebar for all posts
Many thanks
Change History (11)
#3
@
16 years ago
- Resolution duplicate deleted
- Status changed from closed to reopened
What are the ticket number talking about this subject ? Thanks
#4
@
16 years ago
- Milestone set to 2.8
things like #8704
please re-close as dup if it does the trick
#5
@
16 years ago
in trac #8704 the proposed filter is placed upstream and will it be able to place an image url in place of a simple category name? the hook 8704 while large impact in what I propose, only the category (terms) in question. Is my english understandable ?
#7
@
16 years ago
- Cc michelwppi added
- Summary changed from Please : a filter for $category name in get_the_category_list() to Please : a filter for $category object in get_the_category_list()
this ticket #9227 is much more relevant and adapted to the desired functional. Even if wp_list_categories(), a filter exists for each three parts of one element (name, link, and description). Here, just with adding a line like below, the potentialities of adaption are huge :
As in classes.php (line 1328), I suggest this adapted modif with a filter named post_list_cats for the start of two loops present in get_the_category_list() (line 187 et 209)
foreach ( $categories as $category ) { $category = apply_filters( 'post_list_cats', $category);
If, as asked in the cited trac, the echo (display) is added in the function get_the_category_list() (with modif inside the_category), a second param 'echo' can be passed in this filter.
Hope this modif will be implemented soon, to built easy plug and play kit to transform automatically a well made theme in a theme for iPhone or a multilingual theme (without coding by the bloger).
there are a ticket or two in the 2.8 milestone already, that ask for the category list to be filtered, raw, before it gets turned into html. closing this as dup of those.