I am trying to wrap my head around custom post types. What I am trying to achieve is a simple branch listing. There is a dealers menu that has drop downs with regions. When you click on a region I just want it to list branches within the region. Nothing fancy, no maps, just plain text with branch name and contact details + address. Something like this:

Branch Name
Contact Person
Contact number

Branch Name 2
Contact Person 2
Address 2
Contact number 2

I have used custom post UI plugin and another one that lets me add this data in the backend. I can't for the life of me figure out how to display it in the frontend.

I don't want it to act like a post where it lists everything and you click on it for more detail. It should just display as above when you click on a region from the dropdown. Is there a plugin that would do this or do you have to hard code it?

  • You have to make a custom post type archive in your theme like: archive-{$post-type}.php. That's all. It's the core thing. :) – Mayeenul Islam Dec 1 '14 at 5:55
  • Did you create the CPT and custom fields using a plugin? – Brad Dalton Dec 1 '14 at 8:44
  • Hi. Yes, I used a plugin. Custom Post UI I think it was – Jonathan Dec 1 '14 at 20:08

You can do that easy on this way, just duplicate single.php and rename to single-custom-post-type-name.php like single-cars.php, same thing with archive or taxonomy, taxonomy-taxonomy-name.php or archive-taxonomy-name.php

Or you can make your query for random page, home or blog:

// The Query
$query = new WP_Query(array('post_type' => 'your-custom-post'));
query_posts( $query );

// The Loop
while ( $query->have_posts() ) : $query->the_post();  
  // your post content ( title, excerpt, thumb....)

// Reset Query

Good luck! ;)

  • Thank you, I will give this a try in the next day or two. Thanks so much for your response. – Jonathan Dec 1 '14 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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