Automattic / eventbrite-api

The Eventbrite API plugin brings the power of Eventbrite to WordPress, for both users and developers.
68 stars 40 forks source link

images are only working on local staging site, not on live site #81

Open mbrod90 opened 6 years ago

mbrod90 commented 6 years ago

I am creating an event wordpress website using the eventbrite api plugin. The images are only working on my local staging site. I am migrating using the all-in-one wp migration from local to live site.

When I do migrate, all the data is transferred but the images are not being pulled into the live site. The steps I have done are: I created two oath apps. One for local, another for live. I have went into keyring to change the keys. And nothing changes.

I have deleted apps and the only apps I have is All-in-One WP Migration Eventbrite API Eventbrite API - Display Private Events Eventbrite API - One Hour Cache Keyring

I have reset the database. and just installed the eventbrite plugins on it's own. I dont know what I am doing wrong. To get the images, I am using the following reference

<?php the_post_thumbnail(); ?>

and this is in my functions

<?php
/**
 * gbgevents functions and definitions
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
 *
 * @package gbgevents
 */

if ( ! function_exists( 'gbgevents_setup' ) ) :
    /**
     * Sets up theme defaults and registers support for various WordPress features.
     *
     * Note that this function is hooked into the after_setup_theme hook, which
     * runs before the init hook. The init hook is too late for some features, such
     * as indicating support for post thumbnails.
     */
    function gbgevents_setup() {
        /**
        * Add theme support for the Eventbrite API plugin.
        * See: https://wordpress.org/plugins/eventbrite-api/
        */
        add_theme_support( 'eventbrite' );

        /*
         * Make theme available for translation.
         * Translations can be filed in the /languages/ directory.
         * If you're building a theme based on gbgevents, use a find and replace
         * to change 'gbgevents' to the name of your theme in all the template files.
         */
        load_theme_textdomain( 'gbgevents', get_template_directory() . '/languages' );

        // Add default posts and comments RSS feed links to head.
        add_theme_support( 'automatic-feed-links' );

        /*
         * Let WordPress manage the document title.
         * By adding theme support, we declare that this theme does not use a
         * hard-coded <title> tag in the document head, and expect WordPress to
         * provide it for us.
         */
        add_theme_support( 'title-tag' );

        // This theme uses wp_nav_menu() in one location.
        register_nav_menus( array(
            'Primary' => __( 'Primary', 'gbgevents' ),
            'Offices' => __( 'Offices', 'gbgevents' )
        ) );

        /*
         * Switch default core markup for search form, comment form, and comments
         * to output valid HTML5.
         */
        add_theme_support( 'html5', array(
            'search-form',
            'comment-form',
            'comment-list',
            'gallery',
            'caption',
        ) );

        // Set up the WordPress core custom background feature.
        add_theme_support( 'custom-background', apply_filters( 'gbgevents_custom_background_args', array(
            'default-color' => 'ffffff',
            'default-image' => '',
        ) ) );

        // Add theme support for selective refresh for widgets.
        add_theme_support( 'customize-selective-refresh-widgets' );

        /**
         * Add support for core custom logo.
         *
         * @link https://codex.wordpress.org/Theme_Logo
         */
        add_theme_support( 'custom-logo', array(
            'height'      => 250,
            'width'       => 250,
            'flex-width'  => true,
            'flex-height' => true,
        ) );
    }
endif;
add_action( 'after_setup_theme', 'gbgevents_setup' );

/**
 * Set the content width in pixels, based on the theme's design and stylesheet.
 *
 * Priority 0 to make it available to lower priority callbacks.
 *
 * @global int $content_width
 */
function gbgevents_content_width() {
    // This variable is intended to be overruled from themes.
    // Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}.
    // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
    $GLOBALS['content_width'] = apply_filters( 'gbgevents_content_width', 640 );
}
add_action( 'after_setup_theme', 'gbgevents_content_width', 0 );

/**
 * Register widget area.
 *
 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
 */
 function wpt_create_widget( $name, $id, $description ) {
    if (function_exists('register_sidebar')) {
            register_sidebar(array(
                'name' => __( $name ),
                'id' => $id,
                'description' => __( $description ),
                'before_widget' => '<div class="widget">',
                'after_widget' => '</div>',
                'before_title' => '<h2 class="module-heading">',
                'after_title' => '</h2>'
            ));
    }
 }

 wpt_create_widget( 'Footer Left', 'footer-left-widget', 'Displays on the left of footer on all pages' );
 wpt_create_widget( 'Footer Right', 'footer-right-widget', 'Displays on the right of footer on all pages' );
 wpt_create_widget( 'Page Sidebar', 'page', 'Displays on the side of pages with a sidebar' );
 wpt_create_widget( 'Blog Sidebar', 'blog', 'Displays on the side of pages in the blog section' );

/**
 * Enqueue scripts and styles.
 */
 function theme_styles() {
    wp_enqueue_style( 'bootstrap_css', 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css' );
    wp_enqueue_style( 'font_awesome_css', 'https://use.fontawesome.com/releases/v5.2.0/css/all.css' );
    wp_enqueue_style( 'typography_css', 'https://cloud.typography.com/7820272/7984392/css/fonts.css' );
    wp_enqueue_style( 'slickcss', get_stylesheet_directory_uri() . '/css/slick.css', '1.6.0', 'all');
    wp_enqueue_style( 'slickcsstheme', get_stylesheet_directory_uri(). '/css/slick-theme.css', '1.6.0', 'all');
        wp_enqueue_style( 'main_css', get_template_directory_uri() . '/style.css' );
}

 add_action( 'wp_enqueue_scripts', 'theme_styles');

function gbgevents_scripts() {
    wp_enqueue_script( 'popper', 'https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js', array('jquery'), '', true);
    wp_enqueue_script( 'bootstrap_js', 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js', array('jquery'), '', true);
    wp_enqueue_script( 'gbgevents-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );
    wp_enqueue_script( 'slickjs', get_stylesheet_directory_uri() . '/js/slick.min.js', array( 'jquery' ), '', true );
    wp_enqueue_script( 'slickjs-init', get_stylesheet_directory_uri(). '/js/slick-init.js', array( 'slickjs' ), '', true );
}

add_action( 'wp_enqueue_scripts', 'gbgevents_scripts' );

/**
 * Implement the Custom Header feature.
 */
require get_template_directory() . '/inc/custom-header.php';

/**
 * Custom template tags for this theme.
 */
require get_template_directory() . '/inc/template-tags.php';

/**
 * Functions which enhance the theme by hooking into WordPress.
 */
require get_template_directory() . '/inc/template-functions.php';

/**
 * Customizer additions.
 */
require get_template_directory() . '/inc/customizer.php';

/**
 * Load Jetpack compatibility file.
 */
if ( defined( 'JETPACK__VERSION' ) ) {
    require get_template_directory() . '/inc/jetpack.php';

}

/**
 * Eventbrite functions.
 *
 * @package Eventbrite_API
 */
if (!function_exists('eventbrite_get_events')) {
    /**
     * Get an array of Eventbrite events, in the format expected by Eventbrite_Event
     *
     * @param  array $params Parameters for the user_owned_events endpoint to pass during the API call.
     * @param  bool $force Force an API call, don't use cache.
     * @return object API results
     */
    function eventbrite_get_events($params = array(), $force = false)
    {
        return eventbrite()->get_user_owned_events($params, $force);
    }
}
if (!function_exists('eventbrite_get_event')) {
    /**
     * Retrieves event data given an event ID.
     *
     * @param  int $id The Eventbrite event ID to be requested.
     * @param  bool $force Force an API call, don't use cache.
     * @return object Event
     */
    function eventbrite_get_event($id = false, $force = false)
    {
        // Bail if no ID is passed in.
        if (empty($id)) {
            return null;
        }
        // Retrieve and return our event.
        return eventbrite()->get_event($id, $force);
    }
}
if (!function_exists('eventbrite_search')) {
    /**
     * Search Eventbrite public events by any user.
     * Note that not limiting the scope of the search somehow will likely result in timeout errors.
     *
     * @param  array $params Parameters for the event_search endpoint, to be passed during the API call.
     * @param  bool $force Force an API call, don't use cache.
     * @return object API results
     */
    function eventbrite_search($params = array(), $force = false)
    {
        return eventbrite()->do_event_search($params, $force);
    }
}

if (!function_exists('eventbrite_is_single')) {
    /**
     * Determine if a query is for an event single view.
     *
     * @param  mixed $query Null, or an Eventbrite_Query object.
     * @return bool True if an event single view, false otherwise.
     */
    function eventbrite_is_single($query = null)
    {
        // If an Eventbrite_Query object is passed in, check the is_single property.
        if (is_a($query, 'Eventbrite_Query')) {
            return $query->is_single;
        } elseif (get_query_var('eventbrite_id')) {
            return true;
        } else {
            return false;
        }
    }
}

if (!function_exists('eventbrite_event_meta')) {
    /**
     * Output event information such as date, time, venue, and organizer
     */
    function eventbrite_event_meta()
    {

            // Add a contextual link to event details.
            if (eventbrite_is_single()) {
                    // Link to event info on eventbrite.com.
                    $url = add_query_arg(array('ref' => 'wporglink'), eventbrite_event_eb_url());
            } else {
                    // Link to the event single view.
                    $url = eventbrite_event_eb_url();
            }

            if (!function_exists('eventbrite_event_time')) {
                /**
                 * Return an event's time.
                 *
                 * @return string Event time.
                 */
                function eventbrite_event_time()
                {
                    // Determine if the end time needs the date included (in the case of multi-day events).
                    $end_time = eventbrite_is_multiday_event() ? mysql2date('F j Y, g:i A', eventbrite_event_end()->local) : mysql2date('g:i A', eventbrite_event_end()->local);
                    // Assemble the full event time string.
                    $event_time = sprintf(_x('%1$s - %2$s', 'Event date and time. %1$s = start time, %2$s = end time', 'eventbrite_api'), esc_html(mysql2date('F j Y, g:i A', eventbrite_event_start()->local)), esc_html($end_time));
                    return $event_time;
                }
            }
            if (!function_exists('eventbrite_is_multiday_event')) {
                /**
                 * Determine if an event spans multiple calendar days.
                 *
                 * @return bool True if start and end date are the same, false otherwise.
                 */
                function eventbrite_is_multiday_event()
                {
                    // Set date variables for comparison.
                    $start_date = mysql2date('Ymd', eventbrite_event_start()->utc);
                    $end_date = mysql2date('Ymd', eventbrite_event_end()->utc);
                    // Return true if they're different, false otherwise.
                    return $start_date !== $end_date;
                }
                }

            // Add the organizer's name if available. Author-related functions are filtered to use the event's organizer.
            $organizer = '';
            if (!empty(eventbrite_event_organizer()->name)) {
                    $organizer = sprintf('<li class="event-organizer"><span class="screen-reader-text">%s</span><a class="event-organizer-link url fn n" href="%s">%s</a></li>', esc_html__('Organizer', 'writr'), esc_url(eventbrite_event_eb_url(get_the_author_meta('ID'))), esc_html(get_the_author()));
            }
            // Add a venue name if available.
         $venue = '';
         if (!empty(eventbrite_event_venue()->address)) {
                 $venue = sprintf('<li class="event-venue"><span class="screen-reader-text">%s</span><a class="event-venue-link url fn n" href="%s">%s</a></li>', esc_html__('Venue', 'writr'), esc_url($url), esc_html(eventbrite_event_venue()->name));
         }

         apply_filters('eventbrite_event_start', get_post()->start);

            // Start with the event time.
         $time = sprintf('<li class="event-time"><span class="screen-reader-text">%s</span>%s</li>', esc_html__('Event date and time', 'writr'), eventbrite_event_time());
            // title of Event

         $title = sprintf( '<li class="entry-title m-0 mb-4 font-weight-bold"><a href="%s" rel="bookmark">%s</a></li>', esc_url($url), esc_html__('Event Title', 'writr'));

         $details = sprintf('<li class="event-details "><a class="event-details-link btn btn-outline-dark font-weight-bold m-0" role="button" target="_blank" href="%s">%s</a></li>', esc_url($url), esc_html__('RSVP', 'writr'));
         // Add an event Edit link.
         $edit = '';
         if (current_user_can('edit_posts')) {
                 $url = add_query_arg(array('eid' => get_the_ID(), 'ref' => 'wporgedit'), '<a class="vglnk" href="https://eventbrite.com/edit" rel="nofollow"><span>https</span><span>://</span><span>eventbrite</span><span>.</span><span>com</span><span>/</span><span>edit</span></a>');
                 $edit = sprintf('<li class="event-edit"><a href="%s">%s</a></li>', esc_url($url), esc_html__('Edit', 'writr'));
         }
         // Assemble our HTML. Yugly.
         $html = sprintf('<ul class="clear">%1$s%2$s%3$s%4$s%5$s</ul>',  $organizer, $venue, $time, $title, $details);
         echo apply_filters('eventbrite_event_meta', $html, $organizer, $venue, $time, $title, $details);
    }
}

/**
 * Load the menu nav walker for bootstrap by Edward McIntyre
 * https://github.com/twittem/wp-bootstrap-navwalker
 */
require get_template_directory() . '/inc/class-wp-bootstrap-navwalker.php';