Support

Home Forums Event Espresso Premium Questions about single event page child theme

Questions about single event page child theme

Posted: June 4, 2016 at 3:24 pm

Viewing 31 reply threads


Nick

June 4, 2016 at 3:24 pm

I am building a custom page for single events, using the templates in the Espresso_Arabica_2014 folder. The page can be found here: http://test.opendialogueapproach.co.uk/?espresso_events=an-introduction-to-the-open-dialogue-approach

I am stuck on a few things:

1. Removing the link from venue title and entry title
2. Displaying the address line by line (not inline)
3. Can I hide the ‘State’ field in the address if it is not set?
3. Not sure what the star by Qty in the ticket selector table refers to. Can I remove it?
4. Can I include the venue image?
5. For some reason the google map is not displayed on the right – even though there is HTML markup for it. Do you know why this is? (N.B. It is displayed on the left, where I don’t want it!)
6. The ‘content-espresso_events-details.php’ template is not only displaying the description of the event, i.e. everything from ‘In this 1 day workshop…’ down to ‘…and considerable experience working with people experiencing psychosis.’ Instead it is displaying datetime, ticket selector and venue information as well. How can I get it to just show the description?
7. Can I display a custom field on the single event page, and if so, how?

That’s it for now!

Thanks

Nick


Josh

  • Support Staff

June 6, 2016 at 10:21 am

Hi Nick,

1. Removing the link from venue title and entry title

Venue title link: in content-espresso_events-venues.php on line 9 it has this:
$venue_name = espresso_venue_name( 0, 'details', FALSE );
you change it to this:
$venue_name = espresso_venue_name( 0, FALSE, FALSE );

Entry title: has an a href on content-espresso_events-header.php line 11. You remove that html code.

2. Displaying the address line by line (not inline)

Line 29 of content-espresso_events-venues.php you change:
<?php espresso_venue_address( 'inline' ); ?>
to be:
<?php espresso_venue_address( 'multiline' ); ?>

3. Can I hide the ‘State’ field in the address if it is not set?

Maybe. You could try adding some logic or even translate the “Unknown” string to be an empty string.

3. Not sure what the star by Qty in the ticket selector table refers to. Can I remove it?

Yes. You can remove the asterisk there by adding the following to your theme’s functions.php file:

function my_custom_ticket_qty_label( $label ) {
	return 'Qty';
}
add_filter( 'FHEE__ticket_selector_chart_template__table_header_qty', 'my_custom_ticket_qty_label' );

4. Can I include the venue image?

Yes, you add this to your template:

<?php $VNU_ID = espresso_venue_id( $post->ID ); ?>
<?php				
if ( has_post_thumbnail( $VNU_ID )) :
	if ( $img_ID = get_post_thumbnail_id( $VNU_ID )) :
		if ( $featured_img = wp_get_attachment_image_src( $img_ID, 'large' )) :
			$caption = esc_attr( get_post( get_post( $img_ID ))->post_excerpt );
			?>
<div id="ee-venue-img-dv-<?php echo $VNU_ID; ?>" class="ee-venue-img-dv">
	<a class="" href="<?php the_permalink(); ?>">
		<img class="ee-venue-img" src="<?php echo $featured_img[0]; ?>" width="<?php echo $featured_img[1]; ?>" height="<?php echo $featured_img[2]; ?>" alt="<?php echo $caption; ?>"/>
	</a>
</div>
<?php 
		endif;
	endif;
endif;
?>

5. For some reason the google map is not displayed on the right – even though there is HTML markup for it. Do you know why this is? (N.B. It is displayed on the left, where I don’t want it!)

You might need to remove the code for the one that’s displaying on the left. I don’t think the Google Maps API will work to display the same map twice on the same page.

6. The ‘content-espresso_events-details.php’ template is not only displaying the description of the event, i.e. everything from ‘In this 1 day workshop…’ down to ‘…and considerable experience working with people experiencing psychosis.’ Instead it is displaying datetime, ticket selector and venue information as well. How can I get it to just show the description?

The simple way is just don’t use that template part. You can use the_content() instead.

7. Can I display a custom field on the single event page, and if so, how?

Yes you can. This is a good guide that shows how:
https://perishablepress.com/wordpress-custom-fields-tips-tricks/


Nick

June 6, 2016 at 4:14 pm

Wow, it’s like Christmas came early this year! So many gifts all at once. Thanks very much Josh. There’s one I may need to return though. echo the_content() is still returning the same output as espresso_get_template_part( 'content', 'espresso_events-details' );

http://test.opendialogueapproach.co.uk/events/an-introduction-to-the-open-dialogue-approach/


Nick

June 7, 2016 at 3:28 am

There’s one other thing I’d like Josh. I would like to add a line above the ticket selector, stating ‘There are currently x of [total_tickets] available’. How would I do this? I have hunted around the forum for the code, without any joy!


Nick

June 7, 2016 at 11:09 am

One final thing – I hope! – I have created a custom date format, as you can see on the page, using the espresso_event_date_obj function. I am wondering if it is possible to include the iCal link after it?


Lorenzo Orlando Caum

  • Support Staff

June 7, 2016 at 11:53 am

Hi Nick,

Here is one way to show the remaining spots for an event:

https://eventespresso.com/topic/ticketsplaces-remaining-ee4/#post-191823

You could repurpose the espresso_list_of_event_dates function to display in the layout that you are looking for. In this example, its updated to show only the time:

https://gist.github.com/lorenzocaum/41f70b94f7c6b212b145

Any changes to the function would replace the default look of the datetimes section on the event pages:

http://cl.ly/1f1f2X0U472W


Lorenzo


Nick

June 7, 2016 at 2:46 pm

Hi Lorenzo

Both of your suggestions work perfectly for my needs, so thanks. There’s just a couple of things:

1. It’s not clear to me how I get the remaining tickets function to always show the number of tickets left, and not use ‘a lot of’.

2. There was one question above that was missed – Josh suggested I use the_content() in my template to just show the description of my event on a template page, but this is returning the datetime, ticket selector and venue information, as well as the description, as you can see here: http://test.opendialogueapproach.co.uk/events/an-introduction-to-the-open-dialogue-approach/. How do I just return the description?

Thanks,

Nick


Tony

  • Support Staff

June 8, 2016 at 4:52 am

1. It’s not clear to me how I get the remaining tickets function to always show the number of tickets left, and not use ‘a lot of’.

‘A lot of’ should be returned when you do not have a limit set on the tickets. The function checks if there are an infinite amount of tickets available and displays that string.

2. There was one question above that was missed – Josh suggested I use the_content() in my template to just show the description of my event on a template page, but this is returning the datetime, ticket selector and venue information, as well as the description, as you can see here: http://test.opendialogueapproach.co.uk/events/an-introduction-to-the-open-dialogue-approach/. How do I just return the description?

Which template files are you using? I’m guessing you are not using single-espresso_events.php?

EE will inject the details into the the_content() unless you are using that template file, in which case it assumes you are taking over complete control of the output and no longer does so.


Nick

June 8, 2016 at 5:14 am

Thanks Tony. I only have one ticket type for the event so set the limit there, rather than a global limit. Once I set the global limit the ‘tickets remaining’ function behaved as I was hoping.

I am including echo the_content(); in content-espresso_events.php, which, as I understand it, builds on single-espresso_events.php. Even when I include echo the_content(); directly in single-espresso_events.php, in the while loop, it still outputs, everything, including ticket selector, date and venue details.

So, essentially I am looking for a way to return just the description of the event in content-espresso_events.php


Tony

  • Support Staff

June 8, 2016 at 5:27 am

$event->description() will output only the description for the event.

However, to me there seems to be a misunderstanding of how to set this up (although we need more details to confirm, I may well be wrong) and simply using the above may cause problems further down the line.

You have a single-espresso_events.php template file within your child theme correct?

You also have multiple templates copied over from Espresso_Arabica_2014 within your child theme?

Can you send me a copy of the theme so we can see how you have this set up? You can send the theme to support[at]eventespresso.com (please include a link to this thread so we know what the email is for)


Nick

June 8, 2016 at 5:40 am

I tried including $event->description() in both single-espresso_events.php and content-espresso_events.php and it broke the page, so it would seem I am doing something wrong. These are the files that I am using in my child theme:

Screenshot

I will send you the EE files via email now as requested.


Nick

June 8, 2016 at 5:40 am

Oops, these are the files:

Screenshot


Nick

June 8, 2016 at 7:06 am

Hopefully you have received the child theme template files now. Just in case it’s not clear this is where I am wanting the description to appear:


Tony

  • Support Staff

June 8, 2016 at 3:57 pm

Hi Nick,

I loaded your child theme locally with a version of X and only the event description was output within the left div – http://take.ms/9YSUr

I then changed espresso_get_template_part( 'content', 'espresso_events-details' ); to echo the_content(); to confirm if that works as expected and it did.

Have you customized any other files within Event Espresso?

Have you added any filters such as:

​add_filter( 'FHEE__EED_Event_Single__template_include__allow_custom_selected_template', '__return_true' );

To your site to force EE to load all details within the_content()?


Nick

June 8, 2016 at 4:16 pm

Hi Tony,

You’re a genius! When I was trying to customise the single event display before I learned about customising templates, I added this to my functions.php file, presumably something I found on this forum:

//* Allow the custom display order option to work with the archive-espresso_events.php theme template file
add_filter( 'FHEE__EED_Event_Archive__template_include__allow_custom_selected_template', '__return_true' );

//* Allow the custom display order to work with the single-espresso_events.php theme template file
add_filter( 'FHEE__EED_Event_Single__template_include__allow_custom_selected_template', '__return_true' );

Once I removed this only the description showed on my page: http://test.opendialogueapproach.co.uk/events/an-introduction-to-the-open-dialogue-approach/

Thanks very much for your help!

Nick


Tony

  • Support Staff

June 9, 2016 at 1:36 am

You’re most welcome, Nick.

I’m glad its now working for you 🙂

To explain a little about those filters for future readers, when you load a single-espresso_events.php or archive-espresso_events.php template, EE assumes you will be taking full control of the output (such as the case here with the custom EE templates).

However we found a lot of themes would hardcode specific sidebars or some other elements on the single and archive outputs that many users wanted to remove. You could do this with CSS but it wasn’t very user friendly so we created filters to allow you to use a custom template but continue to use the build in ordering feature of EE.

This means you can remove hardcoded elements like sidebars from the output without extensive knowledge of the EE templates (you remove the sidebar from the template and EE did its usual thing with the_content using that ‘custom’ template). However using BOTH the filter and individual custom templates for the EE details results in the problem mentioned above as your telling EE to continue to inject into the_content() and also loading the same details using templates.


Nick

June 9, 2016 at 3:35 pm

Even though the page is now working well (thanks again for all the help) there’s one more question, relating to the remaining tickets script. At the moment it only updates when there’s a completed payment and I’d like it to update for pending payment registrations as well. Is this possible?


Tony

  • Support Staff

June 10, 2016 at 6:16 am

Whilst its possible to pull in all registrations with a status of Pending Payment and Approved and then use those values I just want to make sure your aware that it means that anyone who selects a ticket and enters registration details into the form will apply to those values?

It may seem obvious but its easily overlooked and it means (depending on your setup) that it may be really easy for any user to force your datetimes to show as sold out even though they aren’t.


Nick

June 10, 2016 at 6:33 am

Yes, that’s fine Tony. Once people have a ‘payment pending’ status I am happy for them to be removed from the total sales available. We work with organisations who need time to process payments through their systems. I will be keeping an eye on registrations and will be chasing people for the money! How do I change the function?

Thanks

Nick


Tony

  • Support Staff

June 10, 2016 at 6:56 am

You can do something like this:

//Use this block inside the datetime loop in place of:
//$remain = $datetime->spaces_remaining( true );
$tickets = $datetime->ticket_types_available_for_purchase();

$all_ticket_registrations = 0;

if( ! empty($tickets) ) {
	foreach($tickets as $ticket) {
		$all_ticket_registrations += $ticket->count_registrations( array( array( 'STS_ID' => array( 'IN', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) ) ) ) );
	}
}
   
$remain = $limit - $all_ticket_registrations;

Note the comment at the beginning, that block of code should be use in place of the single line $remain = $datetime->spaces_remaining( true ); within the original function.


Nick

June 14, 2016 at 2:10 pm

Thanks Tony. That works well. A couple of further questions:

1. Is it possible to exclude registrations in the trash from the above calculation?
2. Is it possible to include ‘Payment Pending’ registrations in the calculation for the number of places that show in the Quantity dropdown on the ticket selector. At the moment it is only using Approved Registrations in this calculation.


Nick

June 15, 2016 at 6:09 am

Oh, and also to not count abandoned registrations in the calculation.


Tony

  • Support Staff

June 16, 2016 at 5:20 am

1. Is it possible to exclude registrations in the trash from the above calculation?

To exclude deleted registrations from the list you change:

$all_ticket_registrations += $ticket->count_registrations( array( array( 'STS_ID' => array( 'IN', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) ) ) ) );

to

$all_ticket_registrations += $ticket->count_registrations( array( array( 'STS_ID' => array( 'IN', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) ), 'REG_deleted' => 0 ) ) );

2. Is it possible to include ‘Payment Pending’ registrations in the calculation for the number of places that show in the Quantity dropdown on the ticket selector. At the moment it is only using Approved Registrations in this calculation.

That is not something we can provide support for as it turns out the ticket selector logic would need to be highly customized to work in that way.


Nick

June 17, 2016 at 1:20 am

It now seems to me that Event Espresso isn’t really the solution for my needs, which is frustrating, given that I have got very used to it, and have done a lot of customisation over the last year or so. It was working fine before when I didn’t have a limit on the number of tickets for an event, but now that I do, it no longer works.

My scenario is that I will be regularly running events where there is a limit, but where every registration, both approved and payment pending, needs to count towards the limit, and not only in the function that has now been customised to show the number of tickets left, but also in the dropdown menu where the user selects the number of tickets they want. I need ‘sold out’ to show when the number of approved and payment pending tickets reaches the limit. What happened to me this week is that an event was overbooked, because EE doesn’t work in the way I need it to.

I am aware that I can set registrations to ‘approved’ by default, but this means that an incorrect email is sent out to those who haven’t yet paid – I need them to get a different email with a payment link.

The reason for needing all of this is that I regularly run events where organisations pay for events via invoice, and the payments may well not come for several weeks, sometimes even after an event, but they always pay in the end – hence my needing to count them as essentially ‘approved’ registrations, but with a payment pending status.

If I am wrong and there is a way around this, please let me know.

Thanks,

Nick


Tony

  • Support Staff

June 17, 2016 at 12:54 pm

Hi Nick,

Could you not include a note within the Registration Approved email stating that if they have paid by Invoice their place is not confirmed until payment is received? Even if you allow the user to pay after the event your are basically Approving every registration anyway with the way you want to set it up.

Using a default registration status of Approved and modifying the Registration Approved message template to suit both use cases sounds like it would be a better fit for your event setup rather than modifying EE to use Pending Payment Registration against attendee limits.


Nick

June 17, 2016 at 4:26 pm

Hi Tony. I could indeed do as you suggest for the standard registration email. However, I need a way to send batch messages to those who have yet to pay, reminding them to pay. The way I did this previously was to create a custom ‘Pending Payment’ message, filter registrations by status, and then use the ‘Set Registrations to Pending Payment and notify’ option. I could use a custom ‘Registration Approved’ message instead, but there doesn’t seem to be a way of selecting unpaid ‘Approved’ messages in the registration list.


Lorenzo Orlando Caum

  • Support Staff

June 18, 2016 at 11:02 am

Hi Nick,

If you go to Event Espresso –> Transactions and click on a transaction, then you can send a payment reminder for the transaction.

The button will appear in the top right area of the transaction details screen.


Lorenzo


Nick

June 18, 2016 at 3:50 pm

Hi Lorenzo. I sometimes have 100s of reminders to send out, so I need to be able to do this in bulk.


Tony

  • Support Staff

June 20, 2016 at 5:38 am

Currently to be able to send bulk emails with the default registration status using Approved you would need to manually select registrations that had ‘Incomplete’ transactions, like this – http://take.ms/BT3UP

You can then either set the Bulk Action to ‘Set to Approved and Notify’ to re-trigger the Reg Approved message (which would you can include a remind for Invoice payments) or send a batch email to the selected registrations don the bottom.


Nick

July 4, 2016 at 8:03 am

Thanks Tony. I think that, for my purposes, I am leaning towards setting the default registration status to ‘Approved’, and including both ticket links and payment reminder links in the Registration Approved emails.

If I remember rightly it is not possible to include a payment link in newsletters. If this were possible this would be my preferred method of sending bulk payment reminders. In the absence of this feature I would have to create a custom ‘Registration Approved’ message for payment reminders and use this instead. Am I right in thinking this? If so, would it be possible to include a payment reminder link option for newsletters in a future update?


Tony

  • Support Staff

July 5, 2016 at 9:27 am

Am I right in thinking this?

Yes that is correct.

Create a custom Reg Approved message template, set that as the Registration Approved template on the event you are sending the message out for and then re-trigger the reg approved message type.

If so, would it be possible to include a payment reminder link option for newsletters in a future update?

We are working on adding more shortcodes for the Newsletter message type, 4.9 introduced some changes to how that message type worked and will eventually allow for more shortcodes.


Nick

July 5, 2016 at 3:31 pm

Thanks for confirming Tony. I look forward to learning about the future updates!

Viewing 31 reply threads

The support post ‘Questions about single event page child theme’ 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