Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Barry

    (@barryhughes-1)

    Hi @petehawk – absolutely.

    The easiest way to to this would be to define a custom template and use the various template tags Events Calendar PRO (if you’re referring to their custom additional fields) and/or WordPress (if you’re referring to regular post meta fields) provide to take advantage of this.

    Example:

    [event_embed template="custom-event-item.php"]

    Then create your-theme/tribe-events/custom-event-item.php and within it use code like:

    <div class="eventrocket embedded-event post">
    	<div class="post-thumb"> <?php echo tribe_event_featured_image() ?> </div>
    	<h3> <a href="<?php the_permalink() ?>"><?php the_title() ?></a> </h3>
    	<div class="schedule"> <?php echo tribe_events_event_schedule_details() ?> </div>
    	<div class="summary"> <?php the_excerpt() ?> </div>
    
    	<!-- So far this is just a copy of the default template -->
    	<!-- but depending on the sort of custom fields you want -->
    	<!-- you could use any of the following techniques -->
    	<?php foreach ( tribe_get_custom_fields as $name => $key ): ?>
    		<?php echo "$name: $key" ?> <br/>
    	<?php endforeach ?>
    
    	<!-- Or (using native WP custom fields)... -->
    	<?php foreach ( get_post_meta( get_the_ID() ) as $name => $key ): ?>
    		<?php echo "$name: {$key[0]}" ?> <br/>
    	<?php endforeach ?>
    </div>

    That is of course just a very simple example. I’m not correctly escaping anything and in the case of WP custom fields I’m not testing to see which fields are hidden or if they have multiple values, but it should outline the basic idea.

    Plugin Author Barry

    (@barryhughes-1)

    …If you don’t have Events Calendar PRO installed, then strip out the loop using tribe_get_custom_fields() or you will hit an error ??

    Thread Starter petehawk

    (@petehawk)

    Thanks Barry.. will have a play with this and report back… Just a quick extra question as I’m not too familiar with the coding involved here… if I have an Event Pro additional Field of Tickets with four options to select in the Events back end, do I replace $name or $key with ‘Tickets’.

    Cheers

    Pete

    Plugin Author Barry

    (@barryhughes-1)

    Hey Pete,

    There was a typo in my first snippet. However:

    <?php foreach ( tribe_get_custom_fields() as $name => $value ): ?>
    	<?php echo "$name: $value" ?> <br/>
    <?php endforeach ?>

    This doesn’t literally write either $name or $value to the browser screen – those will be replaced with the name of each available field and it’s value, respectively – give it a try and it will make more sense ??

    Thread Starter petehawk

    (@petehawk)

    You’re a star.. thanks Barry.

    Pete

    Plugin Author Barry

    (@barryhughes-1)

    Pleasure ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘using event_embed with Events Calendar additional Fields’ is closed to new replies.