Ejemplo n.º 1
0
/**
 * Callback for Voce_Settings_API for showing a dropdown of pages
 *
 * @param type $value value of setting
 * @param type $setting setting object
 * @param type $setting_args args from setting
 */
function eventbrite_venue_page_settings_cb($value, $setting, $setting_args)
{
    $dropdown = wp_dropdown_pages(array('echo' => false, 'name' => esc_attr($setting->get_field_name()), 'show_option_none' => __('— Select —', 'eventbrite-parent'), 'option_none_value' => '0', 'selected' => get_eventbrite_setting($setting->setting_key, '0')));
    if (!$dropdown) {
        echo '<p>' . sprintf(__("You don't have any published pages. To use this feature <a href='%s'>create a new page</a> then come back here and update this.", 'eventbrite-parent') . '</p>', esc_url(admin_url('post-new.php?post_type=page')));
        return;
    } else {
        printf('<div class="page-select">%s</div>', $dropdown);
    }
    if (!empty($setting_args['description'])) {
        echo sprintf('<span class="description">%s</span>', wp_kses($setting_args['description'], wp_kses_allowed_html()));
    }
    printf('<p><a href="%1$s">%2$s</a></p>', esc_url(admin_url('post-new.php?post_type=page')), __('Create new page', 'eventbrite-parent'));
}
Ejemplo n.º 2
0
/**
 * Redirect to selected Eventbrite page templates
 *
 * @uses Voce_Eventbrite_API::get_auth_service()
 * @uses eventbrite_venue_get_dynamic_pages()
 * @uses get_queried_object_id()
 * @uses eventbrite_venue_maybe_include_template()
 * @uses get_eventbrite_setting()
 */
function eventbrite_venue_event_template_redirect()
{
    if (class_exists('Voce_Eventbrite_API') && Voce_Eventbrite_API::get_auth_service()) {
        $dynamic_pages = eventbrite_venue_get_dynamic_pages();
        if ($dynamic_pages) {
            foreach ($dynamic_pages as $key => $template) {
                $queried_object_id = get_queried_object_id();
                eventbrite_venue_maybe_include_template(get_eventbrite_setting("{$key}-page-id", false), $queried_object_id, $template);
            }
        }
    }
}
Ejemplo n.º 3
0
<?php

/**
 * Template part home loop
 *
 * @package eventbrite-venue
 */
$venue_id = get_eventbrite_setting('venue-id', 'all');
$organizer_id = get_eventbrite_setting('organizer-id', 'all');
$language = get_eventbrite_setting('call-to-action');
$page = max(1, get_query_var('paged'));
$per_page = get_option('posts_per_page');
$events = Voce_Eventbrite_API::get_user_events(array('per_page' => -1, 'page' => -1, 'venue' => $venue_id, 'organizer' => $organizer_id));
$total_events = count($events);
if ($page > 0) {
    $events = array_slice($events, ($page - 1) * $per_page, $per_page);
} else {
    // return the specified number
    if ($count > 0) {
        $events = array_slice($events, 0, $count);
    }
}
?>
<h1><?php 
_e('Upcoming Events', 'eventbrite-venue');
?>
</h1>

<div class="event-items">
<?php 
if ($events) {