Support

Home Forums Event Espresso Premium Show Sales Date

Show Sales Date

Posted: August 10, 2020 at 2:26 pm


KGM_Adm

August 10, 2020 at 2:26 pm

I want to display the sales dates on each course when I call [Espresso Events]. I’ve activated the setting in the template settings but for me to see the sales dates I have to press show details in the ticket selector. Instead, I would like to not have the ticket selector visible and only show the sales date.

In addition, I want to change the ‘Goes on sale:’ and ‘sale Ends:’ text to ‘Registration Begins’ and ‘Registration Ends:’ respectively. Thank you in advance if this is possible.


Tony

  • Support Staff

August 12, 2020 at 7:05 am

Hi there,

I’ve activated the setting in the template settings but for me to see the sales dates I have to press show details in the ticket selector. Instead, I would like to not have the ticket selector visible and only show the sales date.

Currently, we don’t have an option for this, the ticket are pulled into the ticket selector and then the details for each individual ticket (as each of the tickets on your event could have different settings/dates) is shown in the additional section for each individual ticket.

You could use some custom code to pull this in an display it for each individual event but we don’t have any examples of this so you’ll need the help of a developer. If you are not currently working with one we recommend the folks at Codeable.

In addition, I want to change the ‘Goes on sale:’ and ‘sale Ends:’ text to ‘Registration Begins’ and ‘Registration Ends:’ respectively. Thank you in advance if this is possible.

This can be done, but those details are currently added to the ticket selector, which you mentioned you don’t want to use above, so does this still apply?


KGM_Adm

August 12, 2020 at 10:49 am

You could use some custom code to pull this in an display it for each individual event but we don’t have any examples of this so you’ll need the help of a developer.

I am trying to achieve this with some custom code, I was wondering if you would be able to guide me to the location of the code I need, I can’t seem to find it myself.

This can be done, but those details are currently added to the ticket selector, which you mentioned you don’t want to use above, so does this still apply?

No this longer applies, I will edit those when I find the code to put in, thanks!


Tony

  • Support Staff

August 14, 2020 at 4:24 am

I am trying to achieve this with some custom code, I was wondering if you would be able to guide me to the location of the code I need, I can’t seem to find it myself.

Ok, so are you loading any custom templates currently?

You’re using [ESPRESSO_EVENTS] which calls which loads it’s own template, have you customized that?

There’s not enough details to know what you can’t find so I don’t know where you are stuck. We don’t provide support for customizations but I can help point you in the right direction if you let me know where you are up to.

No this longer applies, I will edit those when I find the code to put in, thanks!

?? It sounds like your trying to edit core files and if that’s the case it’s not the correct way to do this.

The information you need can be pulled from the events using our model system:

https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System

But where you use that depends on the specific of what you are trying to do.


KGM_Adm

August 14, 2020 at 11:14 am

You’re using [ESPRESSO_EVENTS] which calls which loads it’s own template, have you customized that?

I have been editing the file content-espresso_events-shortcode.php directly for editing the template. Is there a different way I should be going about making a custom template?


Tony

  • Support Staff

August 14, 2020 at 11:33 am

It’s not a good idea to edit any core files as they’ll be lost on each and every update.

Create a child theme (if you’re not using one already) and copy that template into the root directory of the child theme, then edit the template there. EE will use that in place of the original.


KGM_Adm

August 14, 2020 at 11:35 am

I am using a child theme but how would you recommend to edit [ESPRESSO_EVENTS] template then?


Tony

  • Support Staff

August 17, 2020 at 3:48 am

My previously reply explained exactly how you should do it.

Create a child theme (if you’re not using one already) and copy that template into the root directory of the child theme, then edit the template there. EE will use that in place of the original.

‘That template’ being content-espresso_events-shortcode.php


KGM_Adm

August 18, 2020 at 1:27 pm

Thanks! I’ve moved the file over to my child theme for any future edits I decide to make.

I am now trying to create a grid layout for the courses. Following this tutorial https://travishorn.com/responsive-grid-in-2-minutes-with-css-grid-layout-4842a41420fe I made a parent div and set the css styles accordingly but there is till not grid it just takes the event box and splits it in half on the left side of the screen.

To create this grid layout do I need to still be editing the shortcode file or is there a separate one I should be using?


KGM_Adm

August 18, 2020 at 1:37 pm

If it is helpful this is my code in the shortcode.php file:

<?php if ( is_archive() ) : ?>
	<div class="kgm-all-courses-flex-box">
		<div class="kgm-single-course-box">
			<?php espresso_get_template_part( 'content', 'espresso_events-header' ); ?>
			
			<div class="kgm-course-details">
				<?php espresso_event_content_or_excerpt(); ?>
				<?php //espresso_get_template_part( 'content', 'espresso_events-datetimes' ); ?>
				<?php //espresso_get_template_part( 'content', 'espresso_events-venues' ); ?>
				<?php $keyvalue2 = get_post_meta( get_the_ID(), 'Ages', true );
				// Check if the custom field has a value.
				if ( ! empty( $keyvalue2 ) ) {
    				echo 'Ages: ' , $keyvalue2;
				} ?>
			</div>

			<div id="espresso-event-thumbnail" class="kgm-course-thumbnail">
				<?php espresso_get_template_part( 'content', 'espresso_events-thumbnail' ); ?>
			</div>

			<div class="kgm-course-desc">
				<?php //espresso_get_template_part( 'content', 'espresso_events-details' ); ?>
				<br>
				<?php $keyvalue = get_post_meta( get_the_ID(), 'Barcode', true );
				// Check if the custom field has a value.
				if ( ! empty( $keyvalue ) ) {
					echo 'Barcode: ' , $keyvalue;
				} ?>
			</div>

		</div>
	</div>

<?php endif; ?>

Then I followed the tutorial on the previously linked site but replaced ‘.cards’ with ‘.kgm-all-courses-flex-box’


Tony

  • Support Staff

August 19, 2020 at 5:35 am

Hi there,

We (Event Espresso support) can’t provide support for other’s tutorials, I can point you in the right direction on how to pull various bits of information from EE/Events etc but walking through how to create a full grid template is outside the scope of support.

I did take a quick look at the code you posted and what you have looks fine to me so I don’t know why it’s not working for you.


KGM_Adm

August 19, 2020 at 8:05 am

Okay, I understand.

If my code is correct then I’m not sure why it is not working either.

The tutorial setups all the divs under one parent div. My question is how are the events put in? since of course, I don’t code in every div for each event box. To clear things up I want the courses laid out in a two-column grid instead of one when I call the shortcode, so I am not certain if this is the right file to be working in anymore.


Tony

  • Support Staff

August 19, 2020 at 9:01 am

Oh, I understand what you are asking now.

content-espresso_events-shortcode.php is calls from within loop-espresso_events.php, that is where you would need your parent div.

It’s starting to sound like you would be better just creating your own shortcode to output a template of your choosing as your now moving into templates that are used for other outputs so be careful on what you edit and test fully.


KGM_Adm

August 21, 2020 at 11:07 am

Thank you that worked perfectly!

I am having a bit of trouble understanding the location of event espresso content. For example, I want to extract just the course description and just the “view details” button, where would I find this? Then I want to change view details text to say “register now”


Tony

  • Support Staff

August 24, 2020 at 4:50 am

EE events are custom post types, so you access the description in the same way you do with normal posts.

However, I recommend you use the model system:

https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System

The ‘view details’ button is part of the ticket selector, you can’t access just that button on it’s own although you can call the ticket selector.

Thing is, the templates you’ve edited already show you how to call all of these sections, so have you gonna through them to find this out? If so, what specifically are you stuck on?


KGM_Adm

August 24, 2020 at 12:46 pm

One thing I am wondering is what exactly does espresso_event_content_or_excerpt(); do?

Right now this is what my event shortcode outputs: https://imgur.com/3n0QIRr

I want to make the following edits:
– Remove the second instance of date times and address shown
– Move the view details button in between the description and Barcode custom field. You said the button is part of the ticket selector but I do not have the ticket selector on so I am not sure why it is appearing for me.
– Remove the ical button only for registration dates (if not possible then just remove it in general)

Below is the code in my content-event_espresso-shortcode.php :

<?php
/**
 * This template will display a single event - copy it to your theme folder
 *
 * @ package		Event Espresso
 * @ author		Seth Shoultes
 * @ copyright	(c) 2008-2013 Event Espresso  All Rights Reserved.
 * @ license		https://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
 * @ link			http://www.eventespresso.com
 * @ version		4+
 */

/*************************** IMPORTANT *************************
 * if you are creating a custom template based on this file,
 * and do not wish to use the template display order controls in the admin,
 * then change the following filter to:
 * add_filter( 'FHEE__content_espresso_events__template_loaded', '__return_true' );
 * comment out calls to the_content() and espresso_event_content_or_excerpt()
 * then UN-comment and position the additional template parts
 * that are loaded via the espresso_get_template_part() function to your liking
 * and/or use any of the template tags functions found in:
 * \wp-content\plugins\event-espresso-core\public\template_tags.php
 ************************** IMPORTANT **************************/
add_filter( 'FHEE__content_espresso_events__template_loaded', '__return_false' );

//echo '<br/><h6 style="color:#2EA2CC;">'. __FILE__ . ' &nbsp; <span style="font-weight:normal;color:#E76700"> Line #: ' . __LINE__ . '</span></h6>';

global $post;
$event_class = has_excerpt( $post->ID ) ? ' has-excerpt' : '';
$event_class = apply_filters( 'FHEE__content_espresso_events__event_class', $event_class );
?>
<?php do_action( 'AHEE_event_details_before_post', $post ); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class( $event_class ); ?>>

<?php if ( is_archive() ) : ?>
		<div class="kgm-single-course-box">

			<div class="kgm-course-title">
				<?php espresso_get_template_part( 'content', 'espresso_events-header' ); ?>
			</div>

			<div class="kgm-course-details">
				<?php espresso_get_template_part( 'content', 'espresso_events-datetimes' ); ?>
				<?php espresso_get_template_part( 'content', 'espresso_events-venues' ); ?>
				<?php $keyvalue2 = get_post_meta( get_the_ID(), 'Ages', true );
				// Check if the custom field has a value.
				if ( ! empty( $keyvalue2 ) ) {
    				echo 'Ages: ' , $keyvalue2;
				} ?>
			</div>

			<div id="espresso-event-thumbnail" class="kgm-course-thumbnail">
				<?php espresso_get_template_part( 'content', 'espresso_events-thumbnail' ); ?>
			</div>

			<div class="kgm-course-desc">
				<?php the_content(); ?>
				<?php $keyvalue = get_post_meta( get_the_ID(), 'Barcode', true );
				// Check if the custom field has a value.
				if ( ! empty( $keyvalue ) ) {
					echo 'Barcode: ' , $keyvalue;
				} ?>
			</div>

		</div>

<?php endif; ?>

</article>
<!-- #post -->
<?php do_action( 'AHEE_event_details_after_post', $post );


Tony

  • Support Staff

August 25, 2020 at 8:53 am

One thing I am wondering is what exactly does espresso_event_content_or_excerpt(); do?

It will either return the event content, or the except depending on if the current output is_single(), is_archive() and depending on your template settings (Event Espresso -> Events -> Templates).

Looks lie your site is still loading the auto injected details, have you followed the steps between the /*************************** IMPORTANT ************************* comment?

– Remove the ical button only for registration dates (if not possible then just remove it in general)

?? Sorry but I don’t understand what you are trying to do.

What do you mean by ‘only for registration dates’?

Below is the code in my content-event_espresso-shortcode.php

The forum isn’t really designed for large sections of code, please use something like pastebin and post the URL to it here for us to view.


KGM_Adm

August 25, 2020 at 1:05 pm

have you followed the steps between the /*************************** IMPORTANT ************************* comment?

Yes I have, I accidentally pasted the older code prior to completing the steps.

?? Sorry but I don’t understand what you are trying to do.

What do you mean by ‘only for registration dates’?

If you take a look at what I have here: https://imgur.com/3n0QIRr I’d like the white ical button to only appear under the datetime labelled ‘Event Dates’ and remove it for any datetime labelled ‘Registration dates’ I’m not sure if this is supported in EE so if not I would just like to remove the ical button completely.

Lastly, I am looking through the template_tags.php file but cannot seem to find how to put in just the description of an event?

Apologies about the large section of code I will make sure to use pastebin if I ever need to post that much code again.


Tony

  • Support Staff

August 25, 2020 at 1:56 pm

Yes I have, I accidentally pasted the older code prior to completing the steps.

So you have now changed the filter to return true?

If you take a look at what I have here: https://imgur.com/3n0QIRr I’d like the white ical button to only appear under the datetime labelled ‘Event Dates’ and remove it for any datetime labelled ‘Registration dates’ I’m not sure if this is supported in EE so if not I would just like to remove the ical button completely.

Oh, I see.

We don’t have the option to selectively load the ical but you can add this function to your site to remove them:

https://gist.github.com/joshfeck/1bc3731cd1c468916c7f

Lastly, I am looking through the template_tags.php file but cannot seem to find how to put in just the description of an event?

Without any filters? $event->description() will output the description.


KGM_Adm

August 26, 2020 at 9:07 am

So you have now changed the filter to return true?

Yes, works now.

you can add this function to your site to remove them:

Thanks!

Without any filters? $event->description() will output the description.

What do you mean by filters? When I tried this I got a critical error, I assume I am using it incorrectly since I am new to PHP, I wrote <?php $event->description(); ?> is this incorrect?


Tony

  • Support Staff

August 26, 2020 at 11:38 am

What do you mean by filters?

Filters that would normally be applied to the_content.

The event description is ‘the_content’ of an EE Event, like the post content of ‘standard’ posts.

Take a look over this: https://www.smashingmagazine.com/2011/10/definitive-guide-wordpress-hooks/

When I tried this I got a critical error, I assume I am using it incorrectly since I am new to PHP, I wrote description(); ?> is this incorrect?

I assumed you’d have pulled the EE_Event object, your code above doesn’t ‘m guessing you aren’t.

Why can you not use espresso_event_content_or_excerpt()?


KGM_Adm

August 26, 2020 at 2:05 pm

Why can you not use espresso_event_content_or_excerpt()?

I want to set up my events in a specific layout and order that I couldn’t achieve with that. I have everything the way I want it but just want to display the description of an event within the ‘kgm-courses’desc’ div. https://pastebin.com/fH6h9vvU

I assumed you’d have pulled the EE_Event object

No, I did not do this, I don’t know what you mean by pull the event object. If I do this will I be able to use <?php $event->description(); ?> to just display the event description?


KGM_Adm

September 2, 2020 at 12:04 am

No, I did not do this, I don’t know what you mean by pull the event object. If I do this will I be able to use <?php $event->description(); ?> to just display the event description?

Bump


Tony

  • Support Staff

September 3, 2020 at 6:20 am

One option is to use the get_event() helper function:

$event = EEH_Event_View::get_event();

Then the above code to output the description.


KGM_Adm

September 3, 2020 at 11:09 am

https://pastebin.com/3ygCYkkN

I have done this and had no success, any idea why it isn’t appearing?


Tony

  • Support Staff

September 3, 2020 at 12:04 pm

You’ll need to add echo to output the description to the page:

echo $event->description();

The support post ‘Show Sales Date’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso