Hi, hope someone can help...
First and foremost php is not my forte but I hope you at least get the gist of where I'm trying to head with this...
I want to spit out a little loop of post assigned to a category. Rather than code the category ID into a page template I need it so the client can change the category within the admin area.
So, I would like to add a custom_field named 'category' where one will simply enter the slug of the category they wish the loop to be published from.
This is what I have (and doesn't work)
<?php $category = get_post_meta($posts->ID, 'category', true); $query = new WP_Query( 'category_name=$category' ); while ( $the_query->have_posts() ) : $the_query->the_post(); echo '<li>'; the_title(); echo '</li>'; endwhile; // Reset Post Data wp_reset_postdata(); ?>
My humble thanks in advance :)