Support

Account

Home Forums Front-end Issues Include meta added via relational post object in an existing query function Reply To: Include meta added via relational post object in an existing query function

  • On some level, I’m certainly wishing that I went the custom events section route as you tend to do. That said, for all of my programming knowledge deficiencies, I find these troubleshooting efforts incredibly addictive, and they’re the reason I’m shoulder deep in javascript training courses and the like. I truly can’t get enough of it. Anyways —

    Shot in the dark, but maybe the following could help us (in some small way) get to the bottom of this, or blaze the best alternative solution path:

    As I have hopefully made clear, “Organizers” is a native custom post type included with the Tribe plugin. So for the sake of testing and my own understanding, I moved from my functions.php over to the single organizer page template (organizer.php).

    We’ve established (or so I meant to) that the upcoming events related to the given organizer are output with echo tribe_organizer_upcoming_events( $organizer_id );

    So I added the following to the template file:

    <?php
    // tribe_get_organizers_ids() function with the event ID I've been testing on
    $test_organizer_ids = tribe_get_organizer_ids(38901);

    And this below the native echo tribe_organizer_upcoming_events( $organizer_id );:

    <?php
    		echo '<pre>';
    print_r($test_organizer_ids);
    echo '</pre>';

    Which returned the organizer IDs, but—predictably, I’m sure—only the IDs of the Organizers set via the native tribe meta field:

    Array
    (
        [0] => 16671
        [1] => 29406
        [2] => 29415
        [3] => 30056
    )

    There’s a good chance this does nothing to help you/us, but at least I can feel slightly less guilt in knowing that you know that I’m not just sitting on my hands while you provide above-and-beyond support.

    Here’s the full edited template file. Maybe the action filters provide some clue with respect to timing as well?

    <?php
    /**
     * Single Organizer Template
     * The template for an organizer. By default it displays organizer information and lists
     * events that occur with the specified organizer.
     *
     * This view contains the filters required to create an effective single organizer view.
     *
     * You can recreate an ENTIRELY new single organizer view by doing a template override, and placing
     * a Single_Organizer.php file in a tribe-events/pro/ directory within your theme directory, which
     * will override the /views/pro/single_organizer.php.
     *
     * You can use any or all filters included in this file or create your own filters in
     * your functions.php. In order to modify or extend a single filter, please see our
     * readme on templates hooks and filters (TO-DO)
     *
     * @package TribeEventsCalendarPro
     *
     * @version 4.4.28
     */
    
    if ( ! defined( 'ABSPATH' ) ) {
    	die( '-1' );
    }
    
    $organizer_id = get_the_ID();
    $test_organizer_ids = tribe_get_organizer_ids(38901);
    
    ?>
    
    <?php while ( have_posts() ) : the_post(); ?>
    	<div class="tribe-events-organizer">
    			<p class="tribe-events-back">
    				<a href="<?php echo esc_url( tribe_get_events_link() ); ?>" rel="bookmark"><?php printf( __( '&larr; Back to %s', 'tribe-events-calendar-pro' ), tribe_get_event_label_plural() ); ?></a>
    			</p>
    
    		<?php do_action( 'tribe_events_single_organizer_before_organizer' ) ?>
    		<div class="tribe-events-organizer-meta tribe-clearfix">
    
    				<!-- Organizer Title -->
    				<?php do_action( 'tribe_events_single_organizer_before_title' ) ?>
    				<h1 class="tribe-organizer-name"><?php echo tribe_get_organizer( $organizer_id ); ?></h1>
    				<?php do_action( 'tribe_events_single_organizer_after_title' ) ?>
    
    				<!-- Organizer Meta -->
    				<?php do_action( 'tribe_events_single_organizer_before_the_meta' ); ?>
    				<?php echo tribe_get_organizer_details(); ?>
    				<?php do_action( 'tribe_events_single_organizer_after_the_meta' ) ?>
    
    				<!-- Organizer Featured Image -->
    				<?php echo tribe_event_featured_image( null, 'full' ) ?>
    
    				<!-- Organizer Content -->
    				<?php if ( get_the_content() ) { ?>
    				<div class="tribe-organizer-description tribe-events-content">
    					<?php the_content(); ?>
    				</div>
    				<?php } ?>
    
    			</div>
    			<!-- .tribe-events-organizer-meta -->
    		<?php do_action( 'tribe_events_single_organizer_after_organizer' ) ?>
    
    		<!-- Upcoming event list -->
    		<?php do_action( 'tribe_events_single_organizer_before_upcoming_events' ) ?>
    
    		<?php
    		// Use the tribe_events_single_organizer_posts_per_page to filter the number of events to get here.
    		echo tribe_organizer_upcoming_events( $organizer_id );
    		echo '<pre>';
    print_r($test_organizer_ids);
    echo '</pre>';
    		 ?>
    
    		<?php do_action( 'tribe_events_single_organizer_after_upcoming_events' ) ?>
    
    	</div><!-- .tribe-events-organizer -->
    	<?php
    	do_action( 'tribe_events_single_organizer_after_template' );
    endwhile;