putting a custom field value into my get_posts
-
Hello,
I am making a site for a clothing store, that will post each item under categories, and then pages will have a custom field where you put in the category, and the category is then put into the following code — “get_posts( “category_name=…” . the idea is that there will be one template for pages and when the client makes a new page they pick which category goes in the page.
Following is my php. At the moment the “<?php echo $value ?>” puts the correct info from the custom field. I just don’t know how to write the php to put it into the get_posts
<?php $mykey_values = get_post_custom_values('cat'); foreach ( $mykey_values as $key => $value ) ?> <?php echo $value ?> <?php $posts = get_posts( "category_name=<?php echo $value ?>" ); ?> <?php if( $posts ) : ?>
Obviously the last two lines are dog food, but that is basically the piece of php I can’t write. Can someone help? Just with what I put after category_name=”the php to echo the custom field value here”
Thankyou.
- The topic ‘putting a custom field value into my get_posts’ is closed to new replies.