Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to display custom taxonomy archives
- This topic has 7 replies, 4 voices, and was last updated 8 years, 12 months ago by boldplan.
-
AuthorPosts
-
December 26, 2013 at 1:54 pm #81286boldplanParticipant
The following is easy to do in typical WordPress themes but definitely not straightforward with Genesis. I have two things I need to accomplish:
1) Have a custom archive page that displays text at the top of a page for the category along with it's description and then the posts in that category. I think I got that one down even though it wasn't straightforward.
2) Do the exact same thing but use a custom taxonomy. The plugins I have show a number of posts that are associated with a taxonomy, e.g. Category Cars, Taxonomy Japanese. But when I try to show all the results for the Taxonomy (Japanese) it doesn't show the results as an archive. I would have thought that the display would use a standard archive template to display them but apparently that's not the case. I guess there you'd need to have a separate call.
December 27, 2013 at 5:48 am #81379Brad DaltonParticipantThe way its done in the Executive Pro theme is the best in my opinion and very easy to add to an existing CPT
January 23, 2014 at 9:08 pm #86752trenchardMemberOK, this is not helpful. Can anyone explain how to do a simple taxonomy-<name>.php template that actually works? Why is this so hidden in the docs?
January 24, 2014 at 3:12 am #86769Brad DaltonParticipantPlease start a new topic. Thanks
My answer relates to boldplans question How to display custom taxonomy archives however i would give a similar answer and ask you try my solution first.
The code for both the taxonomy-portfolio-type.php template and the archive-portfolio.php template is in the files belonging to the Executive Pro theme.
Its simply a copy and paste job which takes 2 minutes and the code is highly flexible and will work with any child theme running on Genesis.
The CSS may need tweaking as different themes sometimes use different classes and values for width etc.
April 26, 2015 at 12:03 pm #149198mikelbylMemberA bit late - but while I believe this is the answer I need, I don't have access to Executive Pro theme, so although I am confident that the solution there is wonderful, it is not accessible to me.
Therefore, are there snippets of this code elsewhere?
April 26, 2015 at 12:10 pm #149203Brad DaltonParticipantApril 26, 2015 at 12:24 pm #149209mikelbylMemberYeah, in forums designed to allow the community of StudioPress customers to help each other, I think it's completely reasonable to expect that, provided someone has the info.
April 26, 2015 at 2:00 pm #149216boldplanParticipantI honestly can't remember how I accomplished this in genesis but I will say this much - brad dalton provides a great deal of help around here, just giving credit where it's due. In fact, he even gives a response as to how it can be accomplished most easily by simply mimicking another template, which I'll look at.
I'll see if I can figure out how I did this, perhaps with a plugin. I really like genesis but it does make a number of the simple things excruciatingly convoluted. I miss the days of a template where you can visualize and customize more easily. I believe I did it like this. If you like it and it works, thank my website. 😉
taxonomy-slugname-sectionname.php
<?php /*
Template Name: TheLaw.com
*/ ?><?php
add_filter ( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' );
add_action('genesis_before_loop', 'archive_do_post_title');
function archive_do_post_title() {if ( is_category() || is_archive() ) {
echo '<h1>Title Here</h1><div class="entry-content">Stuff here.';
echo category_description(1234) . '</div>';
}
}genesis(); ?>
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.