There are various ways to solve this. First coming to mind are checking via is_singular()
or get_post_type()
. Using the latter you could write
foreach( $posts as $p ):
setup_postdata( $p );
$post_type = get_post_type($p);
if ($post_type === Tribe__Events__Main::POSTTYPE) {
//or: if ($post_type === 'tribe_events') {
// Display the date of the event
$p_event = tribe_get_start_time ( $p->ID, 'j F à H \h i' );
if ( $p_event ) {
echo $p_event;
}
else '';
}
endforeach;
Related Posts:
- How to schedule multiple posts while adding new
- order posts by date like craigslist
- How to get the latest posting time of archived pages in WordPress?
- How to insert current date/time in the content of a post?
- How to get the date of a post in WordPress, so I could use it in a script?
- Automatically Updating Publish Date Bug
- How can I show many posts an author has per week?
- If modified on same day, show only time
- Prevent scheduled post being published if date/time is past current date/time
- Automatically add date to the auto generation of post slug
- How i can limit period of post publication?
- Changing default WP-Site creation date
- Get the most recently modified post date of most recently modified post
- How to show different timestamp
- Date is wrong on ‘all posts’ page
- change the post time on multiple posts
- Access last visit time to a post
- Post navigation using date
- Bulk update published posts date randomly using wp-cli?
- How do you update post date (year only) in a separate custom field?
- How to handle dates, trying to calculate time since a post
- date_query returning only the most recent post instead of the post published before today
- What is the use of to_ping and pinged column?
- Prevent Authors from viewing each others Posts
- Removing filter dropdown in posts table (in this case Yoast SEO)
- Listen to Post action
- Export WordPress Posts and Meta Information in CSV format
- How to add post count to wp_nav_menu?
- Posting From Apple Aperture?
- How to know if get_posts() failed?
- Show related posts by category but ignore one category
- how to show all post in my page-grid.php template page
- How to add padding between posts
- eBooks download website, page or post?
- Remove whitespace at the end of posts?
- Add few specific post ids to wp_query
- Disable REST API for a user ROLE
- Add filter-by-tag in the all posts admin console page
- Can I hide a specific post from latest posts page?
- Latest 5 posts (custom post type), each post different CSS
- Add scripts on custom post add/edit pages Not Working
- Getting current post ID in functions.php
- Understand post type
- How can I show wordpress posts based on author?
- previewing my posts on static page?
- How to retrieve the postID in a “image_send_to_editor” hook function?
- Avoid duplicate post from same Taxonomy
- Can I divide the pages into categories?
- Display featured products by category
- Change post order random through out the entire WordPress
- Set size for attachments
- Posts gathered from WPEMatico feeds are being mixed in different languages. Polylang is used for language separation
- How to render arbitrary post without displaying it [closed]
- Shortcode and whitespace formatting problem
- Delete pubished and unpublished posts with wp_delete_post?
- How to remove in-line style of WordPress’s post content only?
- How can I add content to a post that only shows in single-post mode?
- How to Get Posts, Including Private Ones?
- Find the Post ID of a post from another website
- Disable auto-save and post revisions from inside a theme or plugin
- How can I determine where I want to edit in the backend (server)
- Archive template combined with post slider and regular posts
- How to show a custom taxonomy in the theme?
- How to import nested categories from XML file?
- Show posts by quarter
- Make ‘blog’ page show content as well as posts underneath it
- Cant’ Grab WordPress Built-in Posts Through Loop
- Sidebar limiting to 10 posts?
- Attachment image single page
- Short link to read complete post
- Display content between two dates?
- Automatic duplicate/copy of post to a related page in WordPress
- Change Old WordPress Post Date Year
- How to fix wordpress blog post error? Can anyone help to fix this issue?
- Query prints posts without specific categories
- Private post caught in endless redirect loop
- Foreach issue in get_posts function
- migrate only recent posts
- Disable pagination in posts and pages
- Is it possible to make a custom post that adds multiple pages?
- post categories – how to show only categories with a specific parent id
- Creating a “category” of featured posts
- How do I make it so that new posts within a certain category go into a certain page?
- Post URL duplication adds numerical value
- Is it possible to display QUICK EDIT as default for all posts in wp-admin/edit.php page?
- some posts being displayed as pages
- Assign specific ads to specific categories/posts
- Reading Setting Not Working for Number of Posts
- 404 for some custom taxonomy not ALL taxonomy
- Body text disappearing in random posts
- Get part of a page url
- Add default content to post (for specific category)
- Displaying posts on Homepage
- Adding a time stamp on post view
- Where are my posts linked to? I keep getting a Not Found Error, and I have no single.php page
- The post order is different for logged-in and non-logged-in users? [closed]
- Display one post randomly from category on home page
- Change a div background color on Post ID
- How to show all Posts Image, Title and 3 line description on main page?
- CSS code for “inserting a custom post divider” after each post