Сделал так:
<?php
/*
* portfolio section
*/
?>
<div class="container main-container">
<div class="row clearfix">
<div class=" masonry-blog masonry">
<?php $query = new WP_Query('content-masonry'); ?>
<?php if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class('post-in-blog '); ?>>
<div class="post-masonry"> <a href="<?php the_permalink(); ?>" >
<header class="entry-header">
<h2 class="entry-title h5">
<?php echo (get_post_meta($post->ID, 'sq', true)); ?>
</h2>
</header>
<section class="entry-content">
<p>
<?php
echo (get_post_meta($post->ID, 'etazh', true));
?>
</p>
</section>
<footer class="entry-footer">
<div class="meta">
<span class="date-post h6"><?php echo (get_post_meta($post->ID, 'class', true)); ?></span>
<div class="clearfix"></div>
</div>
</footer>
</a> </div>
</article>
<?php endwhile; ?>
<?php endif; ?>
</div>
</div>
</div>