• I have a cpt called “portfolio” that has several taxonomies in it. I’m wanting to have a page that shows all posts from a single taxonomy with feature image thumbnail. Not sure where to start. Can anyone help?

Viewing 6 replies - 1 through 6 (of 6 total)
  • I would create a custom page template, and replace the loop with this:
    (replacing example_taxonomy and example_term w/ yours)

    <?php
    $args = array(
    	'post_type' => 'portfolio',
    	'example_taxonomy' => 'example_term'
    ); ?>
    <?php $my_query = new WP_Query($args); ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    
    	<h1><?php the_title(); ?></h1>
    
    	<?php
    	  if ( has_post_thumbnail() ) {
    	    the_post_thumbnail('thumbnail');
    	  }
    	  the_content();
    	?>
    
    <?php endwhile; ?>

    Then create page that uses your custom page template to display this.

    Thread Starter hig116

    (@hig116)

    Thanks amduffy. This is almost working, but it’s showing all taxonomy, not just the one I specify. I’m using the BWS Portfolio plugin, which may be creating the problem somehow. Do you happen to have any other suggestions that may clear this up?

    Thanks again.

    Thread Starter hig116

    (@hig116)

    This is what I see as a link when I’m in the WP admin and roll over the taxonomy I want to use.

    https://localhost:8888/barrett/wp-admin/edit-tags.php?action=edit&taxonomy=portfolio_technologies&tag_ID=4&post_type=portfolio

    What is tag_id 4 called?

    it should be structured like this –
    'portfolio_technologies' => 'name_of_tag_id_4'

    Thread Starter hig116

    (@hig116)

    Sorry, I read past where you said to change that. I made these changes but I’m still getting all taxonomies. Here’s my code:

    <?php
    /*
    Template Name: Residential template
    */
    get_header();?>
    
    <?php
    $args = array(
    	'post_type' => 'portfolio',
    	'portfolio_technologies' => 'residential'
    ); ?>
    <?php $my_query = new WP_Query($args); ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    
    	<h1><?php the_title(); ?></h1>
    
    	<?php
    	  if ( has_post_thumbnail() ) {
    	    the_post_thumbnail('thumbnail');
    	  }
    	  the_content();
    	?>
    
    <?php endwhile; ?>
    
    <?php get_footer();?>

    Thread Starter hig116

    (@hig116)

    Got it to work using

    $args = array(
    	'post_type' => 'portfolio',
    	'taxonomy' => 'portfolio_technologies',
    	'term' => 'residential'
    
    );

    Thanks for your help.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘List posts from custom post type specific taxonomy with thunbnails’ is closed to new replies.