fix: only show category link anchor tags if the category has a link #863
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
All Submissions:
Changes proposed in this Pull Request:
Homepage Posts and Post Carousel front-end templates render category terms with a link. This omits the
a
anchor tag in the unlikely event that a term lacks a link. This could happen if the term being rendered is a "pseudo term", or a term that's appended programmatically to a post's term output based on some condition other than a true taxonomy term applied to the post.The use case this comes from: a "featured" post meta toggle which programmatically shows a "featured" category label alongside the post's other categories. In this case the "featured" category label is not tied to a true category term, therefore it has no term link.
Bonus: also ensures that if a post with no categories (not even "Uncategorized") gets rendered by Homepage Posts or Post Carousel with categories enabled, the editor renders nothing instead of
0
.How to test the changes in this Pull Request:
functions.php
, temporarily add the following filter:master
, observe on the front-end that the "Pseudo Category" labels get rendered with empty anchor tags (<a href="">Pseudo Category</a>
).Test no categories
master
, observe that items in the editor show0
in place of categories:0
.Other information: