Title: wp_query and functions.php
Last modified: August 20, 2016

---

# wp_query and functions.php

 *  [davidbova](https://wordpress.org/support/users/davidbova/)
 * (@davidbova)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/wp_query-and-functionsphp/)
 * Hello! Im trying to understand why the following doesnt work as I’d like. When
   placed in a normal page template, it works perfectly fine, but when turning it
   into the function, it doesnt seem to return anything at all
 *     ```
       function featuredevent() {
   
       global $query_string;
       parse_str( $query_string, $args );
       $args['post_type'] = array( 'cocktails' );
   
       query_posts( $args );
       while ( have_posts() ) : the_post();
   
       			$cocktailbrand = get_post_meta($post->ID,'cocktailbrand',TRUE);
   
       endwhile; 
   
       	return $cocktailbrand;
   
       }
       ```
   
 * Any insight would be much appreciated. Thank you!!

The topic ‘wp_query and functions.php’ is closed to new replies.

 * 0 replies
 * 1 participant
 * Last reply from: [davidbova](https://wordpress.org/support/users/davidbova/)
 * Last activity: [14 years, 11 months ago](https://wordpress.org/support/topic/wp_query-and-functionsphp/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
