Support

Home Forums Event Espresso Premium [espresso_events] shortcode doesn't work within Advanced Custom Fields

[espresso_events] shortcode doesn't work within Advanced Custom Fields

Posted: August 7, 2015 at 10:18 am

Viewing 7 reply threads


Taryn Mason

August 7, 2015 at 10:18 am

I have the same problem as this guy: https://eventespresso.com/topic/ee4-calendar-shortcode-acfdo_shortcode/

The javascript shows up, div shows up, but the calendar is empty. I’m able to run this shortcode normally through another template and the calendar shows up beautifully. But here it shows up with just the controls.


Josh

  • Support Staff

August 7, 2015 at 11:54 am

Hi Taryn,

Are you calling the calendar shortcode from a do_shortcode() function, if so, there’s a few things you’ll need to do to make sure the calendar’s resources are loaded, and there’s some code that you can use that’s outlined our documentation:

https://eventespresso.com/wiki/events-calendar-add-on/#ee4customizations


Taryn Mason

August 7, 2015 at 12:02 pm

I saw that information about enqueuing scripts/styles. It’s not clear if this needs to happen before wp_header() is called, or if I can do it at the same time as calling do_shortcode(), and it’ll show in the footer.

Anyway that’s a red herring. The calendar itself is the issue – it’s empty so there’s nothing to style or script.


Josh

  • Support Staff

August 7, 2015 at 2:06 pm

Hi Taryn,

I wasn’t intending to mislead you, I’m sorry if it came across that way. If you can provide some more information about how you have the ACF shortcode set up with the page template and field, we can look into this.


Taryn Mason

August 7, 2015 at 2:31 pm

I wasn’t saying you were misleading me. I meant the scripts/styles issue is misleading, it’s not the problem. Basically we’re using Advanced Custom Fields flexible content fields:
http://www.advancedcustomfields.com/add-ons/flexible-content-field/

Basically we use get_row_layout() to find out what the layout is named.

Then we php include a template file based on what the layout is. So in this case we have a layout named ‘calendar’ so we load a calendar.php file.

Within the calendar.php file, we don’t use any fields except a title. Then we run echo do_shortcode(‘[ESPRESSO_CALENDAR]’);

This is the output in HTML – notice there’s no actual calendar output. On another page not using advanced custom fields it renders fine:

<div class="hero hero_internal">
                        
			<div id="espresso-category-legend">
				<p class="smaller-text lt-grey-txt">Click to select a category:</p>
				<ul id="ee-category-legend-ul">
							<li id="ee-category-li-12" class="has-sub" style="background: #f3f3f3;">
								<span class="ee-category"><a href="?event_category_id=event">Event</a></span>
							</li>
							<li id="ee-category-li-13" class="has-sub" style="background: #f3f3f3;">
								<span class="ee-category"><a href="?event_category_id=exhibit">Exhibit</a></span>
							</li>
							<li id="ee-category-li-14" class="has-sub" style="background: #f3f3f3;">
								<span class="ee-category"><a href="?event_category_id=show">Show</a></span>
							</li></ul>
				</div>
				<div class="clear"></div>
								<!-- select box filters -->
				<div class="ee-filter-form">
				<form name="filter-calendar-form" id="filter-calendar-form" method="post" action="">
									<label for="ee-category-submit"></label>
					<select id="ee-category-submit" class="submit-this ee-category-select" name="event_category_id">
					<option id="option" class="ee_select" value="">Select a Category</option>
					<option class="ee_filter_show_all" value="">Show All</option>
					<option value="event">Event</option><option value="exhibit">Exhibit</option><option value="show">Show</option>					</select>
				
									<label for="ee-venue-submit"></label>
					<select id="ee-venue-submit" class="submit-this ee-venue-select" name="event_venue_id">
					<option class="ee_select" value="">Select a Venue</option>
					<option class="ee_filter_show_all" value="">Show All</option>
					<option value="grainger-sky-theater">Grainger Sky Theater</option>					</select>
								</form>
				</div>
				
	<div id="espresso_calendar" class="calendar_fullsize"></div>
	<div style="clear:both;"></div>
	<div id="espresso_calendar_images"></div>                    </div>


Josh

  • Support Staff

August 7, 2015 at 2:50 pm

Can you post the contents of calendar.php in a gist and link to it here?


Taryn Mason

August 7, 2015 at 3:59 pm

Here’s the gist:
https://gist.github.com/burtonkent/22cfa3b2f359b0f391d6


Josh

  • Support Staff

August 7, 2015 at 9:29 pm

This does appear to be an issue with not loading the calendar scripts. It’s important to know that if the fullcalender.js script does not load on the page, no calendar HTML will be output.

Can you try adding this code to the top of the page template that does the check for get_row_layout()?

global $is_espresso_calendar;
$is_espresso_calendar = TRUE;
if ( ! has_action( 'wp_enqueue_scripts', array( EED_Espresso_Calendar::instance(), 'calendar_scripts' ))) {
    add_action( 'wp_enqueue_scripts', array( EED_Espresso_Calendar::instance(), 'calendar_scripts' ));
}
if ( EED_Espresso_Calendar::instance()->config()->tooltip->show ) {
    add_filter('FHEE_load_qtip', '__return_true' );
}

If the above does not work, you can send a copy of the theme to support at thisdomain.com and we can investigate further.

Viewing 7 reply threads

The support post ‘[espresso_events] shortcode doesn't work within Advanced Custom Fields’ 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