Reply To: Masonry Layout with custom taxonomy templates.

Home Forums Pro Version Masonry Layout with custom taxonomy templates. Reply To: Masonry Layout with custom taxonomy templates.

Sandra Saenz


thank You for a prompt reply.

Please take a look on my taxonomy-portfolio.php file:

 * The taxonomy template file.
 * @link
 * @package SandraSaenz

get_header(); ?>

	<div class="col-md-12">

        $taxonomy = get_queried_object()->slug;

        $args = array(
            'post_type' => 'my_portfolio',
            'posts_per_page'=> 20,
            'tax_query' => array(
                    'taxonomy' => 'portfolio',
                    'field'    => 'slug',
                    'terms'    =>  $taxonomy,

        $query = new WP_Query( $args );

        if ( $query->have_posts() ) :

            /* Start the Loop */
            while ( $query->have_posts() ) : $query->the_post();

                 * Include the Post-Format-specific template for the content.
                 * If you want to override this in a child theme, then include a file
                 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
                get_template_part( 'template-parts/content', 'portfolio' );



        else :

            get_template_part( 'template-parts/content', 'none' );

        endif; ?>

        <?php wp_reset_postdata(); ?>
	</div><!-- .col-md-12 -->


In this line I’ve injected my own template get_template_part( 'template-parts/content', 'portfolio' );. It looks like:


  $image = get_field ( 'portfolio_photo' );


<div class="grid-item">
    <a href="<?php echo $image; ?>" data-rel="lightbox">
      <img src="<?php echo $image; ?>" class="img-responsive" alt="">

Also, I’ve changed the plugin’s configuration and removed generic shortcode from the code. You are right. I can choose “Portfolio” post type and also I can select all my categories (taxonomies). Now it looks like:

The problem is that the plugin doesn’t work for me. Now on my category page I can see this:

As You can see all the images are laid out in one column and it looks like the plugin doesn’t work on this page (it doesn’t add any classes to my images).

Thank You for help.

Best regards,
Vladyslav Turak