Custom Post Type Taxonomy archives

Community Forums Forums General Discussion Custom Post Type Taxonomy archives

This topic is: not resolved

This topic contains 9 replies, has 3 voices, and was last updated by  luba lee 2 years, 6 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
  • #40053

    luba lee

    Hello all,

    The Studiopress developers help have pointed me to this forum. I don’t know how to display the taxonomy archives for the custom post type I created. I want them displayed the way a blog displays, the way a category displays: that is a page that renders 10 items, each with its title, photo and a few characters. Please, dive into my little story:

    I’m working on a site for travelers and I’ve started to use custom post
    types with my Genesis Child Theme. We needed a custom kind of content for
    the “single trip”, so I created this CPT with the plugin WP-Types, and I
    created also some taxonomies just for this kind of content. I created as
    well a group of custom fields.

    I also made some hard coded template for my single-trip
    (single-viaje.php). And now it displays the way I wanted, BUT I still have
    some problems and I can’t figure them out:

    This is the appearence of the single trip: In the back end
    everything are custom fields except for the title. The code for that to
    display is:


    * The custom template for the single trip

    /** Force full width content layout */
    add_filter( ‘genesis_pre_get_option_site_layout’, ‘__genesis_return_full_width_content’ );

    remove_action( ‘genesis_before_post_content’, ‘genesis_post_info’ );
    remove_action( ‘genesis_after_post_content’, ‘genesis_post_meta’ );
    remove_action( ‘genesis_after_post’, ‘genesis_do_author_box_single’ );

    get_header(); ?>

    <?php genesis_before_content(); ?>

    <div id=”content” class=”hfeed”>

    <?php genesis_before_loop(); ?>
    <?php genesis_loop(); ?>

    <?php echo custom_taxonomies_terms_links(); ?>

    <div style=”width: 880px; border: thin solid red; overflow: hidden;”>
    <div style=”width: 600px; float: right; padding: 10px;”>
    <?php $imagen_del_viaje = types_render_field(“imagen”, array(“output”=>”html”));
    //Output de la imagen del viaje
    printf($imagen_del_viaje); ?>
    <?php $destacado_viaje = types_render_field(“intro”, array(“output”=>”html”,));
    //output del quicklook
    printf($destacado_viaje); ?>

    <div style=”width: 880px; height: 60px; border: thin dashed black;”><p>&nbsp;</p></div><div style=”width: 880px; border: thin solid green; overflow: hidden;”><div style=”width: 460px; float: left;”>

    <?php $mapa_del_viaje = types_render_field(“mapa”, array(“output”=>”html”));
    //Output del mapa del viaje
    printf($mapa_del_viaje); ?>

    <?php $enlace_pdf = types_render_field(“pdf”, array(“output”=>”html”,”link”=>”true”,”title”=>”Descargar pdf”));
    //Output del enlace
    printf($enlace_pdf); ?>
    <div style=”width: 410px; float: left; border: thin dashed black;”>
    <?php $tabla_del_viaje = types_render_field(“tabla”, array(“output”=>”html”));
    //Output de la tabla del viaje
    printf($tabla_del_viaje); ?>

    <?php genesis_after_loop(); ?>

    </div><!– end #content –>
    <?php genesis_after_content(); ?>
    <?php get_footer(); ?>


    But I don’t know how to code for the page of the custom taxonomies to
    display correctly. Those taxonomies are continents and countries. And I
    want to display the archives page similar to what a blog page would be,
    but instead of posts, trips. That is, title, picture and a few characters
    from the text. But as you can see, the text doesn’t show.

    Also, I don’t want this to appear: the meta info (date, author) nor the
    “Filed under:”. I’ve tried many things but I’m no expert at all at this
    level, and I’m really stuck.

    Could you please help me? I’m lost… Thank you so much.

    Thank you again,





    luba lee

    Hey Brad,

    I really appreciate your quick answer! In fact, the tutorial you point is the place where I began this journey with custom post types. I used the WP-Types plugin. And I even survived how to hard code the single template (I know my way with HTML and CSS but not with PHP).

    But now I’m stuck with displaying the taxonomies. I don’t know what template I should use (or, in fact, code). I just wanted to thank you in advance. I will take a closer look to the plugin you point, see if it can display my taxonomies (I made them, and also I made the child theme, it’s not on the list, but I’ll try). I will keep you informed.

    Gracias! :)



    Hey Luba – I can help with the simple part :-)

    Get the Genesis Simple Edits plugin:‎

    That is the easiest way to modify the Post Info – the author/date type stuff.

    I’m going to spend more time looking through your original post to see if I can offer some guidance on that one too. I’m no expert either! But I have used CPTs and taxonomies a bit so it’s possible that I can point you somewhere useful. I’ll be back with more if I come up with anything.



    OK, first thing: That code for single-viaje.php is way too complicated. You don’t need to repeat the


    thing over and over again. You just need to “turn on” PHP once at the beginning of the file, and as long as the entire file contains PHP code (no HTML) then you don’t “turn it off” (with


    ) again – at least, none of my template files have it. They all end with


    Anyway, to try to be more helpful: I have a CPT with custom fields. The whole thing displays in its entirety with this as my template file – named single-CPTname.php (I’m not using the Simple Edits plugin I mentioned earlier, thus the “remove_action” line to get rid of the Post Info):

    Template Name: My CPT
    add_filter( ‘genesis_pre_get_option_site_layout’, ‘__genesis_return_content_sidebar’ ); // Force Content-Sidebar Layout 
    remove_action( ‘genesis_before_post_content’, ‘genesis_post_info’ );

    Maybe try that and see if you can display the custom fields on your single-CPT page? The code you showed above is way too complicated / messy and I think it may be easier for you to start over. :-)


    luba lee

    Hello EssaySnark,

    Thank you very much for your input. I didn’t know about the “switch on” on PHP :)

    Now it’s cleaner. Anyway, all my single-trip.php ¡are custom fields, except for the title that comes from the loop. So, it cannot be so easy, I must call each of the custom fields and tell them where they go with the help of HTML and CSS. But, hey, that single-trip is no problem, it displays exactly as I wanted! Also, I had used the Simple Edits plugin, but then it hides the meta, author and so EVERYWHERE in the site, and I only want to hide them in the taxonomies page. Now with your remove_action line I’m figuring out how to do it if I can find what template to use.

    The problem I have, as you see if you browse in my (too long) post, is with displaying the taxonomy page. I got two taxonomies: continents and countries. And I wany that when people go to, let’s say, America, the page displays in “blog style” 10 of the trips (in America, of course): that is the title, the picture and a few characters from the text.

    But, what I don’t know is: which is the template that my taxonomy page is using right now?

    As you can see, it displays the title and pic, BUT NOT the text. Now, THAT text is a custom field. How do I make it show?

    Thank you so much to be so patient. I know I’m messing with something bigger than me, but it’s the only way I know to grow! ;)



    luba lee – I’ve got a few pointers for you. Here’s the first: You can reference your custom fields in any template file with this simple code:

    remove_action(‘genesis_post_content’, ‘genesis_do_post_content’);
    add_action(‘genesis_post_content’, ‘my_own_fields’, 1);
    function my_own_fields () {

    However, this is just dumping the fields out in place of the nicely-formatted post content that you’d normally get with a regular post. You’ll need to use some of the techniques you’d originally tried with combining this PHP with HTML in order to format the page as you wish.

    The easiest way to create the archive pages that you want with your CPTs would be to use the Genesis Custom Post Types Archives plugin by Travis Smith – the one wrinkle is that your custom fields may not easily get output there unless they’re loaded into the post content area of your CPT. Maybe there’s a way for that CPT Archives plugin to output the custom fields but I couldn’t figure it out (I just spent an hour playing with it!).

    So a possible solution is, if your plugin that created your custom fields allows you to reference them via shortcode, then you might be able to use those within the content area of each Country custom post you’ll create (e.g., one for Brazil, one for China, whatever – and load each of your custom fields into the content area the same way). Then, Travis’ plugin will pull them into your countries Archive Page because they’re part of the main post content.

    This is a roundabout way to get you there but it avoids too much coding. I think the learning curve is pretty steep unless you’re comfortable with PHP. I don’t have any experience with the plugin you’re using for custom fields so I can’t comment there. I use a lot of CPTs and several taxonomies but custom fields haven’t been as easy. Maybe you’ll have better luck with it!



    I just realized that I didn’t actually answer your main question!

    But, what I don’t know is: which is the template that my taxonomy page is using right now?

    Here’s the file naming standards:

    1. Specific Term: taxonomy-{taxname}-{termname}.php
    2. Archive: taxonomy-{taxname].php

    (Without the curly braces of course.)

    You’ll need to create these files yourself, unless your plugin is doing that for you. If that file doesn’t exist, then WordPress will use another file instead, per the Template Hierarchy.


    luba lee

    Hello dear EssaySnark,

    I’m trying to fit all this new information you are giving me in my empty head! ;)

    I’ll spend this weekend on studying this and reading again the articles I found and the Codex itself. Hopefully, it all will make sense for me.

    I really want to thank you your time and patience. I know one of the problems is that I have “holes” of knowledge that don’t allow me to see the whole thing. I will keep you informed of my little disaster. :)



    luba lee

    Hello all,

    I’m really ashamed to say that I haven’t been able to sort this right. I’ve tried many things but they don’t work completely. As I have lots of deadlines to accomplish, I’m not able anymore to dedicate more time to this question. I’m really sorry.

    Anyway, when I’m free again, I will turn into this again, because it’s important for me to understand how this works.

    Thank you all for your input, and see you soon.


Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.