I’m trying to customize a “tag” template to do what I would think should be easy to do via Genesis, as I know I have done the same type of thing via WordPress using a tag.php file.
I am trying to do a sort ASC of Posts, with individual tags per page. So if my tag is “apples” the use can go to domain.com/tag/apples and see all Posts A-Z for just that tag. If they go to “oranges” domain.com/tag/oranges then all Posts for oranges will be sorted A-Z, and so on.
I have tried testing my theory by going to my archives.php page within my Child theme and adding some WordPress parameters of both
<?php the_tags ?> and
<?php get_tags ?> on the archives page, but I soon realized that adding either one of those without a sort doesn’t seem to display anything.
1.) Get a list of Posts using the same Tag to be sorted ASC?
bonus, but not as important
2.) Display a list of tags: on the Archive/404 page similar to the Authors, Categories, etc
1. Use a function hooked to pre_get_posts to amend the query to order alphabetically. Conditionally limit it to just a tag archive. The function MUST be in your functions.php and not in a tag.php or similar file.
2. This would go into tag.php, just a case of customising the loop – you might want to see how 404.php does it as a starting point.
You must be logged in to reply to this topic.
Are you a blogger, web designer, developer, or website owner looking to generate more income?
Promote products for the largest and fastest growing online website platform as part of our affiliate program.