Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #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-229478

    But is there a simple way to either modify this code or could you suggest new code to enable Tags instead

    Thanks

    #818905

    Hey 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_list

    If you need further assistance please let us know.
    Best regards,
    Victoria

    #819185

    Hi,
    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

    #819357

    Hi 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,
    Victoria

    #819642

    I 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?
    Thanks

    #819647

    There’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

    #819917

    Hi 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

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.