Limit tag output only in template
-
I am trying to limit the tags my theme outputs in my portfolio.php template. I’ve gotten it to limit the tags but it does so in my single-portfolio.php file as well.
So, on website.com/portfolio/ I want it to list:
Item 1
-tag 1
-tag 2
-tag 3
-tag 4
-tag 5But when I click into Item 1 I want it to list all tags.
This is the partially functioning code.
$template_name = get_post_meta( $wp_query->post->ID, '_wp_page_template', true ); add_filter( "term_links-royal_portfolio_cats", 'limit_terms'); function limit_terms($val) { if ( $template_name = 'portfolio.php' ) { return array_splice($val, 0, 5); } }
Also, if alyone can help me append a … to the items where the tag output was limited, I’d be extremely grateful. That would look like:
Item 1
-tag 1
-tag 2
-tag 3
-tag 4
-tag 5…
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Limit tag output only in template’ is closed to new replies.