1

i have this code

<?php   $project_taxonomy_select = get_post_meta( $post->ID, '_ep_project_taxonomy_select', true );
        $theCatSlug = get_term_by( 'id', $project_taxonomy_select[0], 'project_filter' );
        $theCatSlug = $theCatSlug->slug;
echo $theCatSlug; ?>

how to put the php above in "project_filter=" inside my query in the below php code

<div id="project">
<?php $my_query = new WP_Query('post_type=project&posts_per_page=-1&project_filter=the php here');
while ($my_query->have_posts()) : $my_query->the_post(); ?>

    <a class="all project-item <?php echo $tax ?>" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
        <img src="<?php if ( has_post_thumbnail()) { ?><?php $thumb_id = get_post_thumbnail_id(); $thumb_url = wp_get_attachment_image_src($thumb_id,'project-thumb-main', true); echo $thumb_url[0]; ?><?php } else { ?><?php echo esc_url(home_url('/')); ?>assets/img/no-project-thumb-main.jpg<?php } ?>">
        <div class="magnifier">
            <span class="text"><?php the_title(); ?></span>
        </div>
    </a>

<?php endwhile;  wp_reset_query(); ?>
</div>

im using Custom-Metaboxes-and-Fields-for-WordPress

Please Help.. :)

1 Answer 1

1

You'd just use simple string concatentation:

WP_Query('post_type=project&posts_per_page=-1&project_filter='.$theCatSlug);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.