Tagged: post-meta-infos, taxonomy, template
-
AuthorPosts
-
July 14, 2017 at 6:15 pm #821333
Hi there!
I have a custom-post-type with some assigned taxonomies.
For the cpt-blog-page (archive.php) I changed the loop-index.php at line 168 from
$cats .= get_the_term_list($the_id, $taxonomy, '', ', ','').' ';
to
`$cats .= $taxonomy.’: ‘.get_the_term_list($the_id, $taxonomy, ”, ‘, ‘,”).'<br>’;
So far, it works, the page displaystaxonomy_one: Term1, Term2
nexttaxonomy: Otherterm,…But I need the ‘name’ not the ‘slug’, so it looks like this:
Taxonomy One: Term1, Term2
Nexttaxonomy: Otherterm,…Please can You tell me, how can I create a new var for the first $taxonomy.above, which displays the ‘name’?
if I could have a wish ;)
Best Choice: manage it within my loop-index-cpt.php
Second. manage it at least inside the child themeBest regards,
GünterJuly 14, 2017 at 8:19 pm #821401Hey Günter,
Can you post a link to your site? showing the results of the code (you can post it in private content if you want it to be viewed only by moderators). If you check on wordpress codex: https://codex.wordpress.org/Function_Reference/get_the_term_list you should be getting the name which is linked to its proper taxonomy.
Best regards,
NikkoJuly 15, 2017 at 2:48 am #821517Hey Nikko,
you see, I have three taxonomies, labeled as:’Wirkungsbereich‘, ‘Themenbereich‘ and ‘Zielgruppe‘. You can compare each of it with ‘Category‘ in Posts or ‘Portfolio Category‘ in Portfolio.
The special taxonomy-terms are displayed well, e.g. ‘Vienna, Salzburg, Tirol’ but I want to display the taxonomy-label before, like
Category: Vienna, Salzburg, Tirol (in post)
Portfolio Category: Vienna, Salzburg, Tirol (in portfolio)
Wirkungsbereich: Vienna, Salzburg, Tirol (in my cpt organisation)Best regards,
GünterJuly 15, 2017 at 6:27 am #821569Hey Nikko,
an unexpected solution occurred! WordPress provides the function the_taxonomies() in /wp-includes/taxonomy.php, line 3934. This function does exactly what I need. So I only have to replace the enfold ‘post-meta-infos’ with this function.
Your hint at wordpress codex gave the direction!
Thank you very much!Günter
July 15, 2017 at 6:39 pm #821761Hi Günter,
Glad you found the solution! Great job!
If you need further assistance please let us know.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.