You are missing “foreach” loop. Try this way
$latest_cpt = get_posts("post_type=event");
foreach ( $latest_cpt as $cpt_post ) {
$theidone =$cpt_post->ID;
$this_post_id = $theidone; //get_the_ID();
$key_2_value = get_post_meta( $this_post_id, 'custom_select', true );
if( ! empty( $key_2_value )) {
$thisisworking = $key_2_value ;
;}
echo $thisisworking; }
Related Posts:
- get_field not displaying my custom field value
- Get the children of the parent category
- How to check if I’m on the last page of posts?
- Order get_terms() By Custom Field
- Should category.php and The Loop be used if the query needs to be customizable?
- Exclude the category from the WordPress loop
- How do I get the category URL from get_the_category?
- Default WP Gallery – show only galleries of a certain category
- Rearranging posts based on categories
- WP_Query not looking at child category
- Randomise results from a category page?
- Display all posts in category, with specific tag posts at top
- Show div only if post is in specific category
- Add extra fields to Add New Category page
- How to show a category post to a specific registered user
- Display list of Sub-Categories and the posts they contain, within one main Category
- Loop with Dynamic Categories
- Need help adding custom field to category
- adding custom fields to next and previous post link
- How can I create a loop to build slides based on multiple categories using Coda Slider
- Custom query with category exclusion and post-meta “whitelist”
- Sort category page with custom field
- Create a full width responsive header image per page
- Remove child products from woocommerce category page [closed]
- Get a list of commas separated categories inside a loop
- Categories list loop – add separator every year
- How would you create a “weekly” archive?
- How to exclude categories from recent posts, recent comments & category widgets?
- Listing all posts from current category on page
- Display one latest post from multiple categories
- How do I get the total number of categories in a list of search results?
- Check if post belongs to any category
- Return category slug / title from category ID
- How do I display the posts from a custom post type on a category.php page?
- How to group the loop posts in a particular by author?
- Display products for a category, sorted by post_excerpt
- Filter out posts before display category count
- Exclude category from loop not working
- How to put enctype=”multipart/form-data” in categories form?
- Listing Parent, Child and GrandChild Categories and then the PostTitles on Page Template !
- Category archive page – loop through posts of certain tag (with pagination) – pre_get_posts
- Add custom taxonomy under the category title
- If newest post of category is newest post in general, skip first post of category
- a-z list, categories and sub categories in loop
- Why would in_category only return one post in a specific category?
- Is it possible to select and edit the way the most recent post from a certain category is displayed on the page?
- Displaying multiple loops based off of category
- How to loop only categories without posts (+ show category featured image with acf) [closed]
- Additional featured post on first page
- Show all posts for a specific category/author
- Redirect category to url with /category
- create a page which displays a list of categories title+ short description?
- Enter a variable in the ‘category_name’ parameter
- Second level subcategory
- how to define category loop last class in the third
- How to call custom category field data in theme?
- Query Posts Exclude Entire Category
- query in category.php repeats itself
- Class active for Archive link – looped out
- need to add custom field in more products
- Taxonomy name repeating when showing 2 posts from each category
- Retrieving category’s color with get_term_meta
- How to change a post category when the ACF datepicker Field is today
- Display the last post by each category?
- Remove product category placeholder image (Woocomerce)
- WooCommerce – How to show specific category first-rest of products-specific category last
- Counter in loop in foreach
- Listing Texts of Which Custom Field is Null
- How to “group” (categorize) the Pages together?
- Multiple Loops on category.php with pagination on last loop
- How to exclude the last post from a category(featured for example) from the main loop?
- Order by category titles
- ajax for filtering posts by category in wordpress loops
- Inside a loop, how to change CSS class based on category name?
- Exclude current post from loop
- How to query categories with Advanced Custom Fields?
- How to insert category list into post creation page, and retrieve chosen categories?
- Categories list loop – add separator every 3 categories [closed]
- Limit get_categories to show each category once
- How to add custom color fields to the category edit page?
- Display single category name in woocommerce loop
- Show Posts from Single Category Not Working
- Notice: Trying to get property of non-object in : custom fields category
- Is there a reason I cannot get the current category in a loop?
- Category archive is displaying all posts rather than the specific category
- Pagination on category.php and tag.php not working
- new WP_Query all post in a category inside the loop
- Trying to get variables in hacked category dropdown
- Problem with different query loops (and “main loop”) on category template page!
- How to do paging in the loop?
- How to add orderby parameter for sorting on category.php
- category__not_in and id values from variable
- echo get_post_meta of all post in a category to fill up a select field
- How to loop custom post_type from (a) specific category(ies)?
- Do not show sub categories in the loop on archive-product.php
- How to display the parent category if only the child category has been chosen
- Category tags with comma’s
- Display posts of certain categories to specific user roles
- Allow user to select categories that will display in post loop
- Insert HTML content in WP Query at specific point