[wp-trac] [WordPress Trac] #27238: Add parameters to the_taxonomies() and get_the_taxonomies() to deselect linking
WordPress Trac
noreply at wordpress.org
Fri Feb 28 16:47:11 UTC 2014
#27238: Add parameters to the_taxonomies() and get_the_taxonomies() to deselect
linking
---------------------------+------------------------------
Reporter: davidjlaietta | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version: 3.8
Severity: normal | Resolution:
Keywords: | Focuses:
---------------------------+------------------------------
Changes (by SergeyBiryukov):
* version: trunk => 3.8
Old description:
> Currently get_the_taxonomies() automatically wrap all taxonomies that
> they list in anchor tags:
>
> $links[] = "<a href='" . esc_attr( get_term_link($term) ) .
> "'>$term->name</a>";
>
> We would like to have the option to remove these, to display an unlinked
> list of taxonomies that are applied to a post:
>
> $list[] = $term->name;
>
> The patch that I've attached includes a 'links' parameter to both
> the_taxonomies() and get_the_taxonomies(), set to true to not affect
> existing usage of these functions. If the parameter is set to false, only
> the taxonomies will be returned, and not their links.
New description:
Currently get_the_taxonomies() automatically wrap all taxonomies that they
list in anchor tags:
{{{
$links[] = "<a href='" . esc_attr( get_term_link($term) ) .
"'>$term->name</a>";
}}}
We would like to have the option to remove these, to display an unlinked
list of taxonomies that are applied to a post:
{{{
$list[] = $term->name;
}}}
The patch that I've attached includes a 'links' parameter to both
the_taxonomies() and get_the_taxonomies(), set to true to not affect
existing usage of these functions. If the parameter is set to false, only
the taxonomies will be returned, and not their links.
--
Comment:
Replying to [comment:1 hereswhatidid]:
> then $taxonomy_list would contain an array of just the term names.
That would print taxonomy names, but not term names. You can, however use
`strip_tags()` to get rid of links:
{{{
$taxonomies = array_map( 'strip_tags', get_the_taxonomies() );
echo implode( ' ', $taxonomies );
}}}
Looks like [attachment:27238.diff] is made against 3.8 rather than current
trunk, so it cannot be applied properly.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/27238#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list