-
AuthorPosts
-
July 10, 2017 at 12:46 pm #818687
Hi,
I’d like the option to show a posts tags below the title in a portfolio grid.
I found a solution to show the post Categories below the title in this support thread
https://kriesi.at/support/topic/enfold-portfolio-grid-category-display/#post-229478But is there a simple way to either modify this code or could you suggest new code to enable Tags instead
Thanks
July 10, 2017 at 6:05 pm #818905Hey agilecic,
You can use the get_the_tag_list() function instead of the get_the_term_list function used there.
https://codex.wordpress.org/Function_Reference/get_the_tag_listIf you need further assistance please let us know.
Best regards,
VictoriaJuly 11, 2017 at 9:48 am #819185Hi,
So this is the code I’m using:switch($contents) { case "excerpt": $excerpt = $entry->post_excerpt; $title = $entry->post_title; break; case "title": $excerpt = ''; $title = $entry->post_title; break; case "only_excerpt": $excerpt = $entry->post_excerpt; $title = ''; break; case "no": $excerpt = ''; $title = ''; break; } $cats = get_the_tag_list($the_id, 'portfolio_entries', '', ', ','').' '; if(!empty($cats)) { $excerpt = '<span class="blog-categories minor-meta">'.__('in','avia_framework')." "; $excerpt .= $cats; $excerpt .= '</span>'; }
And I get the “in” then nothing after it. When I inspect I see the “blog-categories” class has been created but I don’t see any of the Tags I created in the backend.
Thanks
July 11, 2017 at 2:25 pm #819357Hi agilecic,
You did not pay attention to the parameters list, they are not the same for this function.
This line is wrong$cats = get_the_tag_list($the_id, 'portfolio_entries', '', ', ','').' ';
Try this instead
$cats = get_the_tag_list('<span>Tags: ',', ','</span>', $the_id,);
If you need further assistance please let us know.
Best regards,
VictoriaJuly 11, 2017 at 9:40 pm #819642I tried that and my site won’t load. Not front or backened, just blank white page. When I comment out that line of code it works again. Is there a mistake in that line perhaps?
ThanksJuly 11, 2017 at 9:55 pm #819647There’s a comma after $the_id which shouldn’t be there:
$cats = get_the_tag_list('<span>Tags: ',', ','</span>', $the_id);
Thanks it works now to show the tags. They appear as links but is it possible to have them output as CLASS or ID because I want to replace each tag with a graphic through CSS. e.g
<span class=”Tag1″>Tag1</span>
<span class=”Tag2″>Tag2</span>Thanks
July 12, 2017 at 10:59 am #819917Hi agilecic,
Sorry about that, yeah the comma should not be there. You have the code how to get the tags, now you can change how to output it. If it seems too complicated, you could hire a freelancer to do it for you.
If you need further assistance please let us know.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.