Displaying Custom Post Types by category (2 posts)

  1. WideOpenCommunications
    Posted 4 years ago #

    I've looked and looked for help on this and either can't find it or can't understand it. Using various tutorials, I learned how to make a custom post type (called vendors). I get them to write and display, but now my issue is I need them to display only within their respective categories. I created a taxonomy called vendor_categories and created categories like Cakes, Attire, Honeymoon, ect. The site is not live, but URLs will display like so...

    http://www.thewednet.com/wedding-network/ (main page. created vendor.php to display various vendor info)

    http://www.thewednet.com/wedding-network/cakes (only cake vendors should display)

    http://www.thewednet.com/wedding-network/attire (only attire vendors should display)

    and so on. I can get the test vendors which I entered to display, but can not figure out how to get specified ones to display, depending on the URL of the page. Below is my code I have thus far...

    			$loop = new WP_Query( array(
    			  'post_type' => 'vendors',
    			  'posts_per_page' => 10 )
    			while ($loop->have_posts()) : $loop->the_post();
    			  echo '<div class="vendorcard">';
    			  echo '<a href="'.get_post_meta($post->ID, "business_website", true).'" target="_blank" border="0" title="'.get_the_title().'">';
    			  the_post_thumbnail('thumbnail', array('class' => 'vendorlogo'));
    			  echo '</a>';
    			  echo '<a href="'.get_post_meta($post->ID, "business_website", true).'" target="_blank" class="businesslink">'.get_the_title().'</a><br/>';
    			  echo get_post_meta($post->ID, "business_description", true) .'<br/>';
    			  echo '<b>Address:</b> '.get_post_meta($post->ID, "business_address", true).'<br/>';
    			  echo '<b>Phone:</b> '.get_post_meta($post->ID, "business_phone", true).'<br/>';
    			  echo '<b>E-mail:</b> <a href="mailto:'.get_post_meta($post->ID, "business_email", true).'">'.get_post_meta($post->ID, "business_email", true) .'</a>';
    			  echo '</div>';
    			  echo '<div style="clear:both"></div>';

    Any help would be more then righteous. Thanks in advance.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.