Try this after your $wpdb query:
// collect calendar id's
$ids = array();
foreach( $calendar_entries as $calendar_entries):
array_push( $ids, $calendar_entries->id );
endforeach;
// query the above calendar id's
$args = array(
'post_type' => 'post',
'post__in' => $ids,
'orderby' => 'id',
'order' => 'DESC'
);
$query = new WP_Query( $args );
You can also modify the WP_Query by using posts_where, posts_join
and posts_clauses.
Related Posts:
- How can I query the db to access current post information?
- get_results using wpdb
- Count & Display Database Queries
- Importing posts from old website to new conflicting post ID’s?
- Export wordpress table to excel
- How best to inject ads between posts in the loop?
- Change SQL get_results to search for posts with custom term in custom taxonomy
- Change all http to https in mysql databse?
- WooCommerce – Query for ordered products
- PHP variable in WordPress database query
- Delete duplicate rows from wordpress database where a column is duplicate in phpmyadmin
- When and why should I use $wpdb different return types?
- Query WordPress database by registered date and role
- How to prevent WordPress from retrieving data for the last 10 posts in the database?
- Query from a different database than the default
- How to query the WordPress database to get posts of a certain custom post type, taxonomy and field?
- Select Multiple meta_value from WP DB; Single Query
- how to store arrays into a database
- CRUD operations using WordPress database API
- Hook directly into query execution
- get_tags() return an empty array after added tags with wp_insert_term()
- Storing Array from returned database query and using the array in a new query
- Advanced SELECT query with condtional statements
- Select two sums with single get_var statement
- Replace/Mute/Stop Search Query
- sanitize POST arrays
- Slow queries constantly getting stuck on WordPress database of ~100,000 posts
- cache specific data?
- How Can I Put Meta_Compare in the Database-Query?
- How to paginate information obtained from a query to a custom table?
- Historic WordPress database connection
- Check if an option exists and get its value in one hit
- Query multiple tables at once?
- $wpdb->query can’t insert data
- Custom WordPress Table wpdb
- Best practice to limit results in get_row()?
- How to display content from external db with relevant urls
- Connecting to a different database
- SQL query to set posts in bulk based on the post content
- Query Column of Specific ID from Database Table
- Custom search query by category id
- How to display data from db in select list [closed]
- Compare User meta_value with Product meta_value
- wpdb Insert unknown post data dynamic foreach loop
- How to insert a value to decimal type field using wpdb->prepare?
- Join Query on WP_USERMETA Table
- Insert NULL value using prepare()
- Job and Employee Performance Tracking with Product Safety
- WordPress Settings API Overrides My Previous Value
- WordPress Database Query works in phpMyAdmin but not in the code
- wpdb query to insert images in to post/page gallery
- Set SQL_BIG_SELECTS and MAX_JOIN_SIZE on a WP_Query
- Performance bug – slow DB query
- How to optimise this database query?
- How can we speed up wp_get_nav_menu_items()?
- Extracted CSV as Array for Custom Query Loop
- Should I Use only wpdb Class to Write Custom Queries?
- Generating an HTML table from an array based on dynamic key values
- Get id from database
- Unserializeing multiple column values that are stored in one database results variable
- Pulling values from a sepcific row in table
- Create hundreds of users with just ID in phpMyAdmin
- WordPress loop: Display if posts exist
- database search feature
- Query parsing only author ids
- SQL Query to get post_id from wp_posts and and meta_key(s) from wp_postmeta
- SQL query to rewrite all media URLs to end with .webp
- How do I find users by password?
- How is better to store at DB 1-side relationsip from CPT to many Taxonomies Terms ID’s?
- large number (bigint) for post ID issue in database
- SQL errors when querying for something with apostrophes
- Saving zero as meta value
- Transferring/Uploading Data from DB to WordPress
- Delete all posts that do NOT have a specific tag
- Changing order of db results when encoding to JSON
- How to transfer from localHost to live but use the already existing database on the server?
- How not to display ALL items of a database
- How to get the records from start with A to G in php and mysql
- Link multiple user databases together?
- I wanted to Know that how can I give ingore to 0000-00-00 in my config file
- Set a cron job to delete a specific database table table every midnight
- Two separate wordpress installations at one domain
- Can we store password in without being hashing?
- I would like some help wth an SQL query to link posts with categories
- Error establishing a database connection in wordpress
- Where is the HTML-handler part in the wpdb class?
- Counting user’s comments – efficient way?
- Migrate not successful, DB is broken. How to fix, or at least output static HTML without plugins?
- Both VPS and domain changed but Database URL stayed the same and PHPmyadmin inaccessible to change it
- Filtering data and saving query results
- Find/ascertain latest wordpress db from multiple database copies
- Local Content different from Remote Content
- save content in to wordpress wp_post table of database
- DB access blocked when initializing WP externally
- Saving data to database and exporting to excel
- Site does not work right, pages not showing up, even for root admin
- One information repeated on multiple locations on one site [closed]
- WordPress: Interact with Database Query Data and Login
- Showing Error(TAble already exist)
- Getting an error when trying to migrate to DV server from Grid with Media Temple [closed]