-
-
Save anonymous/6194b2631d4d32574b6edb2e46d9ee6e to your computer and use it in GitHub Desktop.
Theme Functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* CUSTOM FILTERS */ | |
// Remove Event Espresso Pop Up Messages | |
// add_filter('FHEE__EE_Front_Controller__display_errors', '__return_false'); | |
// Change Event Espresso "Register Now" button for events | |
add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text', 'css_change_ticket_button'); | |
function css_change_ticket_button() { | |
return 'Begin Registration'; | |
} | |
// Change Event Espresso Table Title for Ticket Description | |
add_filter('FHEE__ticket_selector_chart_template__table_header_available_tickets', 'css_table_title_description'); | |
function css_table_title_description() { | |
return 'Available Training Options'; | |
} | |
// Change Event Espresso Table Title for Ticket Price | |
add_filter('FHEE__ticket_selector_chart_template__table_header_price', 'css_table_title_price'); | |
function css_table_title_price() { | |
return ''; | |
} | |
// Change Event Espresso Table Title for Ticket Quantity | |
add_filter('FHEE__ticket_selector_chart_template__table_header_qty', 'css_table_title_quantity'); | |
function css_table_title_quantity() { | |
return 'Select The Number Of Attendees Needing Registration'; | |
} | |
// Change Event Espresso Thank You Message | |
add_filter('FHEE__thank_you_page_overview_template__order_conf_desc', 'css_thankyou_message'); | |
function css_thankyou_message() { | |
return '<h3 class="divider">Thank You For Registering!</h3><p>You have been successfully registered.<br />We will send your full payment and registration confirmation results to you via email.</p>'; | |
} | |
// Change Event Espresso Finalize Registration Button Text | |
add_filter('FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'css_finalize_registration_button', 10, 2); | |
function css_finalize_registration_button( $submit_button_text, EE_Checkout $checkout ) { | |
if ( !$checkout instanceof EE_Checkout || !$checkout->current_step instanceof EE_SPCO_Reg_Step || !$checkout->next_step instanceof EE_SPCO_Reg_Step) { | |
return $submit_button_text; | |
} | |
if ($checkout->next_step->slug() == 'finalize_registration') { | |
$submit_button_text = 'Complete Registration'; | |
} | |
return $submit_button_text; | |
} | |
// Change Event Espresso checkout text | |
add_filter('gettext', 'css_change_ee_text', 10, 3); | |
if ( !$checkout instanceof EE_Checkout || !$checkout->current_step instanceof EE_SPCO_Reg_Step || !$checkout->next_step instanceof EE_SPCO_Reg_Step) { | |
function css_change_ee_text( $translated, $original, $domain ) { | |
// This is an array of original strings and what they should be replaced with | |
$strings = array( | |
'Name and Description' => 'Registration Type', | |
'Qty' => 'Attendees', | |
'Price' => 'Course Cost', | |
'Total' => 'Total Cost' | |
); | |
// See if the current string is in the $strings array and if so, replace its translation | |
if (isset($strings[$original])) { | |
// This accomplishes the same thing as __() but without running it through the filter again | |
$translations = get_translations_for_domain( $domain ); | |
$translated = $translations->translate( $strings[$original] ); | |
} | |
return $translated; | |
} | |
} | |
// Change messaging for ticket to registration | |
add_filter( 'gettext', 'ee_change_ticket_messaging_registration', 10, 3 ); | |
function ee_change_ticket_messaging_registration( $translated, $original, $domain ) { | |
$strings = array( | |
'The dates when this option is available for purchase.' => 'The dates when this registration is available for purchase.', | |
'This option allows access to the following event dates and times. "Remaining" shows the number of this ticket type left:' => 'This registration allows access to the following event dates and times. "Remaining" shows the number of this registration type left:', | |
'You need to select a ticket quantity before you can proceed.' => 'You need to select a registration quantity before you can proceed.', | |
'No tickets were added for the event.' => 'No registrations were added for the event.', | |
'Name and Description' => 'Registration Name and Description', | |
'The following checkboxes allow you to use the above information for only the selected additional tickets/attendees.' => 'The following checkboxes allow you to use the above information for only the selected additional registrants/attendees.', | |
); | |
if ( isset( $strings[$original] ) ) { | |
$translations = get_translations_for_domain( $domain ); | |
$translated = $translations->translate( $strings[$original] ); | |
} | |
return $translated; | |
} | |
/* CUSTOM ACTIONS */ | |
// Change the ticket action status for the sold out message | |
add_action('FHEE__ticket_selector_chart_template__ticket_sold_out_msg', 'ee_custom_messaging_ticket_action_status_sold_out'); | |
function ee_custom_messaging_ticket_action_status_sold_out() { | |
echo 'Sold Out'; | |
} | |
// Change the ticket action status for the goes on sale message | |
add_action('FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', 'ee_custom_messaging_ticket_action_status_goes_on_sale'); | |
function ee_custom_messaging_ticket_action_status_goes_on_sale() { | |
echo 'On Sale'; | |
} | |
// Change the ticket action status for the not available message | |
add_action('FHEE__ticket_selector_chart_template__ticket_not_available_msg', 'ee_custom_messaging_ticket_action_status_not_available'); | |
function ee_custom_messaging_ticket_action_status_not_available() { | |
echo 'Not Available'; | |
} | |
// Change the ticket action status for the closed message | |
add_action('FHEE__ticket_selector_chart_template__ticket_closed_msg', 'ee_custom_messaging_ticket_action_status_closed'); | |
function ee_custom_messaging_ticket_action_status_closed() { | |
echo 'Registration Closed'; | |
} | |
// Additional changes to messaging for ticket to registration | |
add_action( 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', 'ee_additional_change_ticket_messaging_registration_a' ); | |
function ee_additional_change_ticket_messaging_registration_a() { | |
return 'Registration Price Breakdown'; | |
} | |
// Additional changes to messaging for ticket to registration | |
add_action( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', 'ee_additional_change_ticket_messaging_registration_b' ); | |
function ee_additional_change_ticket_messaging_registration_b() { | |
return 'This registration allows access to the following event dates and times.'; | |
} | |
// Additional changes to messaging for ticket to registration | |
add_action( 'FHEE__registration_page_attendee_information__attendee_info_not_required_pg', 'ee_additional_change_ticket_messaging_registration_c' ); | |
function ee_additional_change_ticket_messaging_registration_c() { | |
return 'This registration type does not require any information for additional attendees, so attendee #1\'s information will be used for registration purposes.'; | |
} | |
// Additional changes to messaging for ticket to registration | |
add_action( 'FHEE__registration_page_attendee_information__auto_copy_attendee_pg', 'ee_additional_change_ticket_messaging_registration_d' ); | |
function ee_additional_change_ticket_messaging_registration_d() { | |
return 'The above information will be used for any additional registrants/attendees.'; | |
} | |
// Additional changes to messaging for ticket to registration | |
add_action( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', 'ee_additional_change_ticket_messaging_registration_e' ); | |
function ee_additional_change_ticket_messaging_registration_e() { | |
return 'Total Cost'; | |
} | |
/* REGISTER SIDEBARS */ | |
// Right Sidebar | |
register_sidebar(array( | |
'name' => 'Right Sidebar', | |
'id' => 'right_sidebar', | |
'before_widget' => '<section id="%1$s" class="widget-wrapper %2$s">', | |
'after_widget' => '</section>', | |
'before_title' => '<h3 class="divider">', | |
'after_title' => '</h3>' | |
)); | |
// Training Sidebar Without Registration | |
register_sidebar(array( | |
'name' => 'Training Sidebar Without Online Registration', | |
'id' => 'training_sidebar_without_registration', | |
'before_widget' => '<section id="%1$s" class="widget-wrapper %2$s">', | |
'after_widget' => '</section>', | |
'before_title' => '<h3 class="divider">', | |
'after_title' => '</h3>' | |
)); | |
// Training Sidebar With Registration | |
register_sidebar(array( | |
'name' => 'Training Sidebar With Online Registration', | |
'id' => 'training_sidebar_with_registration', | |
'before_widget' => '<section id="%1$s" class="widget-wrapper %2$s">', | |
'after_widget' => '</section>', | |
'before_title' => '<h3 class="divider">', | |
'after_title' => '</h3>' | |
)); | |
/* REGISTER POST TYPES */ | |
// Projects | |
register_post_type('training', | |
array( | |
'label' => 'Training', | |
'description' => '', | |
'capability_type' => 'post', | |
'menu_icon' => 'dashicons-calendar-alt', | |
'public' => true, | |
'publicly_queryable' => true, | |
'show_ui' => true, | |
'show_in_menu' => true, | |
'hierarchical' => true, | |
'exclude_from_search' => false, | |
'supports' => array( 'title', 'page-atrributes', 'thumbnail' ), | |
'labels' => array( | |
'name' => 'Training', | |
'singular_name' => 'Training', | |
'menu_name' => 'Training', | |
'add_new' => 'Add Training', | |
'add_new_item' => 'Add New Training', | |
'edit' => 'Edit', | |
'edit_item' => 'Edit Training', | |
'new_item' => 'New Training', | |
'view' => 'View Training', | |
'view_item' => 'View Training', | |
'search_items' => 'Search Training', | |
'not_found' => 'No Training Found', | |
'not_found_in_trash' => 'No Training Found in Trash', | |
'parent' => 'Parent Training' | |
), | |
) | |
); | |
/* ENQUEUE SCRIPTS */ | |
// Add default base theme scripts | |
if( ! function_exists('css_base_scripts')) { | |
function css_base_scripts() { | |
// jQuery | |
wp_deregister_script('jquery'); | |
wp_register_script('jquery', includes_url( '/js/jquery/jquery.js'), false, NULL, true); | |
// Modernizr (without media query polyfill) | |
wp_register_script('modernizr-js', get_template_directory_uri() . '/js/modernizr.js', array(), '', true); | |
// Foundation | |
wp_register_script('foundation-js', get_template_directory_uri() . '/js/foundation.min.js', array(), '', true); | |
// Primer | |
wp_register_script('primer-js', get_template_directory_uri() . '/js/primer.js', array(), '', true); | |
// Html5shiv | |
global $is_IE; | |
if ($is_IE) { | |
wp_register_script ( 'html5shiv', "http://html5shiv.googlecode.com/svn/trunk/html5.js" , false, true); | |
} | |
// Enqueue scripts | |
wp_enqueue_script('jquery'); | |
wp_enqueue_script('modernizr-js'); | |
wp_enqueue_script('foundation-js'); | |
wp_enqueue_script('primer-js'); | |
wp_enqueue_script('html5shiv'); | |
} | |
} | |
add_action('wp_enqueue_scripts', 'css_base_scripts'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment