• 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.