theiogroup
Forum Replies Created
Viewing 5 replies - 1 through 5 (of 5 total)
-
Forum: Plugins
In reply to: [The Events Calendar] Can’t edit single-event.phpIt was /tribe/events/single-event-blocks.php – My bad!
Nevermind, I’m an idiot. I didn’t use an array for multiple post types…
Solved!
Feel like this really should be working or I’m missing something obvious. I’ve checked the database and can see the ID are matching as they should be, e.g. Company#1’s post ID is 224, and the ‘author_company’ field value on a press release I’ve associated with them is ALSO 224… So why aren’t they showing up……?
Tried this with no luck ??
<?php global $post; $post_id = get_queried_object_id(); $company_posts = get_posts(array( 'numberposts' => -1, 'post_type' => 'article', 'press_release', 'podcast', 'video', 'meta_key' => 'author_company', 'meta_value' => $post_id )); foreach($company_posts as $company_post) : setup_postdata($company_post); ?> <div class="author-posts-item"> <?php echo '<span class="icon-' . $post_type = get_post_type( $company_post->ID ) . '"> </span>'; ?> <a href="<?php the_permalink( $company_post->ID ); ?>"> <?php echo get_the_post_thumbnail( $company_post->ID, 'thumbnail' ); ?> <span class="title"><?php the_title( $company_post->post_title );?> </a> <span class="date"><?php echo get_the_date( 'F jS, Y', $company_post->ID ); ?></span> <span class="views"><?php echo getPostViews( $company_post->ID ); ?></span> </div> <?php endforeach; ?> <?php wp_reset_query(); ?>
Doesn’t display anything, even though there are posts which should be displayed (their relationship field should match the current post ID (company)).
Perhaps something like this? But I’m not sure if it’s missing anything…
$value = get_the_id(); $posts = get_posts(array( 'numberposts' => -1, 'post_type' => 'article', 'press_release', 'podcast', 'video', 'meta_key' => 'author_company', 'meta_value' => $value ));
Viewing 5 replies - 1 through 5 (of 5 total)