Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-sales domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the better-click-to-tweet domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-amazon domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-stats domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
How to customize your Available Spaces text | Event Espresso - Staging Server

How to customize your Available Spaces text

In some cases, you may not always want to display the number of available spaces, but you do want to let people know that spaces are, in fact, available. In certain situations, there may be the perception that if there are a lot of available spaces, that an event may close, which would dissuade people from signing up even if that isn’t the case. This simple tweak will allow you to inform your users that there are spaces available without disclosing exactly how many until there are only a few left.
[s2If current_user_can(access_s2member_level1)]

Usage notes:

You will be modifying PHP code. You will need a text editor or an IDE. Always make a backup and, if possible, test on a local or development install rather than making changes to your live site. Template files should always be uploaded to /wp-content/uploads/espresso/templates/ and not the plugin templates directory. While we have provided this tutorial and may be able to provide some amount of support for it, we cannot support any customizations you make to your own site.



Note: This will be updated for Event Espresso 3.2.

There are two files that we will be looking at. event_list_display.php and registration_page_display.php.

In your favorite text editor or IDE, open event_list_display.php and scroll down to lines 94-106. This deals with the Available Spaces message that appears in the event list. We are going to change the text from “Available Spaces: ” and a number, to something more friendly that does not reveal the number of spaces available. Jump down to line 103 and replace this:

<?php if ($display_reg_form == 'Y' && $externalURL == '') {?>
<p id="available_spaces-<?php echo $event_id ?>" class="spaces-available"></p>
<p id="available_spaces-<?php echo $event_id ?>" class="spaces-available"></p>
<?php 
        }
?>

with this:

<?php if ($display_reg_form == 'Y' && $externalURL == '') {
?>
<p id="available_spaces-<?php echo $event_id ?>" class="spaces-available"><span class="section-title">
<?php if ( get_number_of_attendees_reg_limit($event_id, 'available_spaces') >= '10' ) { 
echo 'Sign up now! Spaces are available!'; 
} else { 
echo 'Time\'s running out!  Only ' . get_number_of_attendees_reg_limit($event_id, 'available_spaces') . ' spaces left!'; } ?></span></p>
<?php
}
?>

This will display this message if there are 10 or more spaces available:

Sign up now! Spaces are available!

and this message if there are less than 10:

Time’s running out! Only xx spaces left!

While we’re at it, let’s change the default waiting list and no spaces available messages a little friendlier. Pop up to line 97. This area deals with what happens if there are no available spaces left. First, on line 97, we’re going to replace this:

 
<p id="available_spaces-<?php echo $event_id ?>"><span class="section-title"><?php _e('Available Spaces:', 'event_espresso') ?> </span><?php echo get_number_of_attendees_reg_limit($event_id, 'available_spaces', 'All Seats Reserved') ?></p>

with this:

<p id="available_spaces-<?php echo $event_id ?>"><?php echo get_number_of_attendees_reg_limit($event_id, 'available_spaces', 'There are no more spaces available for this event.') ?></p>

If you have waiting lists set up, you might want to change the text that displays for that (line 99). Replace this:

<p id="register_link-<?php echo $overflow_event_id ?>" class="register-link-footer"><a class="a_register_link" id="a_register_link-<?php echo $overflow_event_id ?>" href="<?php echo espresso_reg_url($overflow_event_id); ?>" title="<?php echo stripslashes_deep($event_name) ?>"><?php _e('Join Waiting List', 'event_espresso'); ?></a></p>

with this:

<p id="register_link-<?php echo $overflow_event_id ?>" class="register-link-footer"><a class="a_register_link" id="a_register_link-<?php echo $overflow_event_id ?>" href="<?php echo espresso_reg_url($overflow_event_id); ?>" title="<?php echo stripslashes_deep($event_name) ?>"><?php _e('Sign up on the waiting list?', 'event_espresso'); ?></a></p>

So, the whole thing will look like this:

<?php $num_attendees = get_number_of_attendees_reg_limit($event_id, 'num_attendees'); //Get the number of attendees. Please visit http://staging.eventespresso.com/forums/?p=247 for available parameters for the get_number_of_attendees_reg_limit() function.
    if ($num_attendees >= $reg_limit) {
        ?>
<p id="available_spaces-<?php echo $event_id ?>"></p>
<p id="register_link-<?php echo $overflow_event_id ?>" class="register-link-footer"></p>
<p id="available_spaces-<?php echo $event_id ?>" class="spaces-available"></p>
<p id="available_spaces-<?php echo $event_id ?>"></p>
<p id="register_link-<?php echo $overflow_event_id ?>" class="register-link-footer"></p>
<p id="available_spaces-<?php echo $event_id ?>" class="spaces-available"></p>
<?php 
        }
    } 
?>

Feel free to let us know in the forums if you have any questions about this tutorial![/s2If]
[s2If !current_user_can(access_s2member_level1)]

The page you are trying to access is reserved for VIP Members and Event Espresso Developer License holders. Please upgrade your support license for Event Espresso, purchase VIP access or log-in. If you think you are receiving this message in error, contact us.

[/s2If]


Need more help?

  • Browse or search for more information on this topic in our support forums. Customers with an active support license can open a support topic and get help from Event Espresso staff.
  • Have an emergency? Purchase a support token and get expedited one-on-one help!
  • Go back to documentation for Event Espresso
Event Espresso - Staging Server