The background: I am new new new to Wordpress, to CMS's in general. I have been trying for 2 days to get this to work but I am not succeeding.

I about 20 different custom post types. Each post type will have between 5 and 50 posts in it, the posts listing products my company is selling. We are not using an e-shop or anything for various reasons.

I used MoreFields to define metadata on each product, and now I would like to format my archive page to automatically list the products on the archive page when I post one. I would like it to display a thumbnail of the product, the name, price, etc in a list view.

How do I do this? Am I going about it all wrong and backwards?

Explain it to me like I'm five, please. Thank you very much for any help you can give.

  • 1
    nice edit @kaiser that title needed it :)
    – Sagive
    Mar 29, 2012 at 18:41

1 Answer 1


In Taxonomy.php (Create on if have none) in your template folder
You should have something similer to this code:

(taxonomy are similer to archive.php but used for custom post type)

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <!--=== TO GET THE TAXONOMY TITLE ===-->
    <h1><?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); echo $term->name; ?></h1>
<?php endwhile; ?>
<?php endif; ?>

<?php if (have_posts()) : while (have_posts()) : the_post(); 

    // FIELDS NAME SHOULD REPLACE 'custom_field_name'
    $meta_value = get_post_meta($post->ID, 'custom_field_name', true);
    $meta_value2 = get_post_meta($post->ID, 'custom_field_name2', true);

    $image_id = get_post_thumbnail_id();  
    $image_url = wp_get_attachment_image_src($image_id,'large');  
    $image_url = $image_url[0];  
    <div class="productContainer">
    <?php echo get_the_post_thumbnail($post->ID, 'thumbNameDefined'); ?>
    <h3><?php the_title(); ?></h3>
    Value of something: <?php echo $meta_value; ?>
    Value of some Other thing: <?php echo $meta_value2; ?>
<?php endwhile; ?>
<?php endif; ?>


In functions.php you should "enable" the use of thumbnail's for that custom post type like you would for regular post... here is the line that does that for some custom post types in a theme i am currently building:

add_theme_support( 'post-thumbnails', array( 'post', 'engagement_ring', 'wedding_ring') ); // Add support for posts and custom post type
add_image_size( 'post', 250, 175, true );
add_image_size( 'engagement_ring', 300, 300 );
add_image_size( 'wedding_ring', 300, 300);

Please note that you should replace the word 'thumbNameDefined' in the first code i added with the name of the custom post type so it would appear..

This is (i think) above the information the avrage 5 year old child
could embed so i hope it helps you

Cheers, Sagive.

  • Not shure if it makes too much sense to add the same image size twice ;)
    – kaiser
    Mar 29, 2012 at 18:55
  • Sagive, Thank you so much! I have to work a bit on the thumbnail but it is a step in the right direction. I'm thrilled to pieces the items are actually showing up.
    – Malory
    Mar 29, 2012 at 19:15
  • 1
    :) right @kaiser hehe.. its just for the example - i ctrl+D that line..
    – Sagive
    Mar 29, 2012 at 19:51
  • Sure thing @Malory - happy to help
    – Sagive
    Mar 29, 2012 at 19:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.