If I understand you, you want to filter out faculty members who do not have any awards at the query stage.
Replace your code:
<?php query_posts( 'post_type=mtt_page'); ?>
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
with this (untested):
<?php
$args = array(
'post_type' => 'mtt_page',
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => 'awards',
'compare' => 'EXISTS'
)
)
);
$members = new WP_Query( $args );
?>
<?php if ( $members->have_posts() ) while ( $members->have_posts() ) : $members->the_post(); ?>
Note that I believe the EXISTS meta_query comparison only works in WP 3.5 onwards.
As a few people have pointed out – query_posts is best avoided.
Related Posts:
- what is the correct way to compare dates in a WP query_posts meta_query
- Using meta_query, how can i filter by a custom field and order by another one?
- Return all custom meta data for one custom post type
- How to filter custom posts by tags and custom fields?
- Display Custom Post Type Fields
- How to hook get_terms() to only show count of posts that have custom meta
- order by meta_value serialized array
- How to get current post id of a custom post type in a loop using template singel-{custom type}.php?
- Display custom post types with custom date field value (before today) & order by custom date field
- How to insert content from another Custom Post type into Post?
- Custom post type content using custom fields without template
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- Homepage’s content is dependent on the custom field values (set automatically), how do I get homepage to update without manually updating page?
- Adding Page Templates to post but it ignored it
- How to get_term_meta on single custom post?
- Best way to create a search for custom post type by custom field values
- Incorrect ordering of custom post type based on time
- WP query_posts group by meta field related
- Add custom template ‘sub-page’ to Custom Post type?
- Custom taxonomy template for custom fields loop [closed]
- Query Distinct Taxonomies of Custom Post Type
- How to grab data (titles, thumbnails and custom fields) from multiple posts to populate a new array efficiently?
- Display ACF object field data using Elementor Custom Query
- How to Add Custom Fields to a Custom Post Type?
- Get the ID of the latest post
- Do_Shortcode not working for Embed
- tag.php doesn’t work with tags on a custom post type post?
- Assign single template to multiple custom post types?
- Display custom post type and custom fields within a Bootstrap Carousel
- how to filter by last name for custom post
- Search that will look in custom field, post title and post content
- clients list using wordpress
- Custom taxonomy query for a custom post type
- How to do a custom bookmarks post type?
- How do I add media to a custom post type?
- How do I create new content pages for my Custom Post Type?
- Using new WP_Query in shortcode in a custom field causes the main post content to not display
- Custom field losing p tags on display
- Using posts and postmeta table to store custom Address Book Plugin data
- How to display recent posts added in several custom post types
- Frontend posting – everything saves other than checkboxes?
- Help with CPT template pagination
- Query Custom Post Types by date (custom field) range
- handling csv data with a custom post type
- Merge multiple custom post types in a single archive template
- Custom query shows custom post types in trash
- query posts and custom post type with meta key
- Dynamically add / duplicate custom meta in custom post types
- Custom Post type and Custom Field WP_Query
- Custom Post Type template stored in plugin folder not showing in post attributes dropdown
- Adding Show Less/More link to Custom Post Meta
- Query/list all terms and their custom post count
- How to clone the “Projects” Custom Post type in Divi theme
- Sorting custom post type columns with external data and without meta values
- What is the recommended / best way to do this: Event calendar post/type in a block-based theme?
- Polylang non-default language ignores tags in WP_Query
- Custom post type archive page for multiple post types
- How to add multiple markers on the google map, at a certain meta_key and meta_value
- How to display Related Posts based on number of taxonomy terms matched
- Custom fields for custom post type
- How can I use archive-{post_type}.php theme template?
- Pagination not working on custom query on a page
- Custome fields not displayed
- How do I assign a block template (.html) to a custom post type?
- How do I get_the_postID() for a custom post that uses ACF repeater field?
- Custom post type name and assigning custom taxonomy
- Custom post types, disable fields
- Building a Portfolio and need some direction
- HM CMB: Post Select Field for CPT ID
- 4 posts per page from single category
- Confusion about how to use Custom Post Types, Custom Taxonomy or Category?
- Displaying Posts Using a Custom Query with a Custom Field and a term_id
- Having a repeating custom field in admin custom post type, what I’d go better with, for DB’s sake? ACF repeater or query a different post type?
- Create an user checklist system for a course plateform using ACF Pro and ACF Extended
- Auto update publish date of CPT Post if default post custom field value match to cpt post CF Value
- WP_Query get always custom post_type for first
- Limit custom post type to the authors only on front-end!
- Post Click Redirect to Custom URL instead of Single Post Page
- wp_insert_post deleting previous post custom meta
- Show posts from WP Custom Post Type selected from a field in a metabox
- meta query multiple values for the same key
- Custom post types – meta_query: search lesson which starts sooner
- WordPress Custom Post Type – Post Attribute: Template. Template shows up and saves on the back end, but the default theme file is being rendered
- Importing URLs of Audio Enclosures
- How to make a custom search template for custom taxonomy?
- DIVs not showing correctly on CPT?
- Retrieving custom post type fields without a post
- pre_get_posts with multiple post types AND a meta_key
- Search form to find custom meta box generated data
- WordPress custom post type
- Display Custom Post if custom field is marked
- predefined custom field on registration page
- Show Custom Post Type taxonomy term that matches custom field
- Select Menu for Custom post Type does not save
- Template with Custom Post Type (Custom Tables) does not work
- Allow authors to create article image
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- How to create custom page templates with default page layout framework?
- Update Custom Field daily within 7days
- How can I produce multiple webpages with a different output based on one entry/Page/custom Page?