Retrieve Category ID from Custom Field For WP Loop
-
I’m setting up a custom ‘Artists’ page template that will include a section that will display latest posts from a category. However, since that template is going to be used for multiple ‘Artists’, I want to be able to add a Custom Field for the category section so it knows to pull from that specific category.
I’ve tried the following, but it doesn’t seem to work.
<?php $audiocategory = get_post_meta($post->ID, 'artist-audio-category', true); $audio = new WP_Query('cat=$audiocategory'); while ($audio->have_posts()) : $audio->the_post(); ?>
Any help would be appreciated.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Retrieve Category ID from Custom Field For WP Loop’ is closed to new replies.