If I understand the question you are trying to show both post on single.php something like this should work as a second loop.
Put This INSIDE the first loop. Do this so you can get the current post ID
$parent_id=the_ID();
// Second Loop
$query = new WP_Query( array ( 'post_type' => 'TYPE1', 'meta_key' => $parent_id ) );
while ( $query->have_posts() ) : $query->the_post();
//normal loop stuff such as the_content();
echo '<li>';
the_title();
echo '</li>';
endwhile;
Related Posts:
- Triple meta_key on custom SELECT query
- Lack of composite indexes for meta tables
- Safe to delete blank postmeta?
- How to get all term meta for a taxonomy – getting term_meta for taxonomy
- delete unused postmeta
- Short of raw SQL, can I query for multiple attachment metadata that have a given array key?
- Get updated post meta on save_post action?
- How to get the total number of meta_values based on a custom post type?
- Insert post metadata for all posts in CPT at once if metadata no existent
- Set Condition echo function get_post_meta
- Get a row from a separate table by matching a posts meta_key to a tables ID column
- Compare string with post id in wpdb and do stuff when match is found
- Which is faster wpdb & get_row or wp_query & ge_post_meta?
- Read post meta values, only if posts are public
- How to test the outcome of a wpdb query?
- How to delete duplicate records in wp_postmeta database table?
- wpdb->get_var – count author posts, meta value
- How to query and update one colum in postmeta table?
- Display current ranking of post as a number in post title
- get specific values from WordPress meta_value
- Get data from custom table and update relative post_meta based on meta_key
- “BS_” rows in postmeta table
- why is my postmeta table is so heavy
- Get table parameter and save in meta value
- Display multiple meta_key/meta_values by single SQL query
- Exclude category from DB query
- Fetching array of postmeta with $wpdb and in_array conditional
- Which query method to use? (edit- wpdb syntax problems)
- Using mysql queries to delete custom post types based on meta_value
- Cache metadata for set of posts
- Export posts with postmeta without ID?
- How to get all the related ids without array?
- Should I use wpdb prepare?
- How we get_post_meta without post id
- What is the code to get the download link for a product in WooCommerce?
- $wpdb->delete column values IN ARRAY()?
- Adding an assisting editor box to Post page
- Inserting Post Meta From SQL
- Get Advanced Custom Fields values before saving [closed]
- Why am I getting an infinite loop with have_posts?
- How to store post meta in an array?
- update_post_meta() not working when used with WordPress action
- What causes the “max_user_connections” warning on WordPress frontend?
- Get posts by meta value with date
- Activation hook not creating table
- How to check for empty and not a failure
- Delete post meta conditionally after save post
- Job of meta_key meta_value fields in database tables
- Query 2 meta key values and a category
- Mysql query LIKE not working
- how to build (custom) stats for post views, per month
- get_post_meta pagination
- Removing Post Meta from Category Pages?
- Hey, I want the second options. get_post_meta()
- Update post meta in woocommerce order frontend
- Unique Post Meta Values
- Using hook to use DISTINCT in a wp_query
- Creating mySQL procedure with $wpdb
- How can I convert postmeta from unserialized to serialized?
- Return terms from multiple taxonomies using $wpdb
- add_post_meta adds meta to one more different post
- $wpdb->insert() does not Insert record in a table
- WordPress SQL Issue not returning correct reselts
- Custom query, multiple custom keys
- Trying to get property of non-object error using get_post_meta()
- update_post_meta not working in plugin
- Look up all posts by status or meta value – performance difference
- Can A Post Meta Field Store multiple values that are not in an array?
- esc_attr on get_post_meta [closed]
- Mixing variables into an array when inserting values
- Sort custom posts in archive by multiple values: date AND meta key
- How is the author’s name given a different color?
- Output: “Array”
- How does WordPress treats attachments metadata in post content?
- URL to Post Meta [closed]
- Retrieving post meta array (attachment)
- $wpdb->get_var multiple queries in one database check
- Stop `update_post_meta` from working each time page refreshes?
- List users with the most posts in the last 30 days
- get_post_meta in one post only
- wordpress mysql / wpdb ajax load more for terms help
- Get child product categories from parent product category for CUSTOM TAXONOMY archive page
- Post Publish date not display on Umaya Child themes
- How to merge the database results into single result?
- Convert a column of a table containing an Array as response in HTML
- How can I update this array built from post meta data?
- How to improve my non-unique metadata MySQL entries?
- How to get the total of two meta values from different meta keys?
- Delete oldest wordpress post (SQL query)
- How to search usermeta table
- How do you sort the items in a custom taxonomy meta box?
- ACF plugin and field update
- post_title in save_post action
- Copy wp_postmeta from one database to another
- How to make an sql query to exclude everything but custom taxonomy terms in table wp_terms?
- Getting meta content from get_next_post & get_previous_post
- How to get pictures of the WordPress post
- When importing posts to a new site if XML file has postmeta not setup on new server what happens?
- Access Serialized Post Meta Values
- Does post-meta belong in header?