[Plugin: Simple Fields] Using within WP_Query loop
-
Hi. I am having trouble using this within the WP_Query. It’s working fine within the post loop but not when I try run a loop. Here is the scenario I am running:
I have a custom post type called videos and use the simple fields filename and category. When I run code the following in the single output it works as expected:
$filename = simple_fields_get_post_value($postID, array(1, 1), true);
$category = simple_fields_get_post_value($postID, array(1, 2), true);However after this post I would like to show a list of related videos. I have a WP_Query which works to get all my video post but when I try filtering by simple_fields values it gets no results. Here is the code I am using:
<?php $loop = new WP_Query( array(
‘post_type’ => ‘rm_video’,
‘posts_per_page’ => 5,
‘orderby’ => ‘title’,
‘meta_key’ => ‘_simple_fields_fieldGroupID_1_fieldID_2_numInSet_0’,
‘meta_value’ => $category
)); ?>Any suggestions?
- The topic ‘[Plugin: Simple Fields] Using within WP_Query loop’ is closed to new replies.