Support

Home Forums Event Espresso Premium Event Espresso with Custom Field Suite

Event Espresso with Custom Field Suite

Posted: November 10, 2018 at 5:49 pm


salda

November 10, 2018 at 5:49 pm

Hi guys,
I’ve been searching through the forum and haven’t found a case like this, so hopefully someone can help…

We’re using Custom Field Suite throughout the site to create relationship pickers in an effort to minimise duplicate content (and maintenance of said content). My client has a custom post type called “Publications”, in which they create each individual publication item (downloadable pdfs, youtube links, etc). Then from within any page, post, etc, there’s another Custom field suite field relationship picker that lists everything belonging to the publications custom post type, and I output whichever items they’ve picked onto the template.

Only problem is that I can’t seem to make the Publication picker (that displays on pages/posts etc) on the Event espresso event edit screen. I’ve specified within Custom field suite that the post type needs to equal espresso_events. The relationship picker simply doesn’t show on the edit screen (and no, the field isn’t available in Screen options).

Is there some way to get the custom field suite picker to show? If it was a simple text field I’d use the Custom Fields area, but this is a more complex relationship picker that dynamically updates the publications available for selection based on what exists in the custom post type (this is what they see on the Page/Post edit screen):
Add Publications

Any help greatly appreciated. We’ve used this Add Publications picker on every other post, page and custom post type object so far, so for consistency and ease of client use we are wanting to use the same on the espresso_events object.
Once it shows up on the edit screen I’ll be able to add it to our single-espresso_events template.

Cheers,
Min


Tony

  • Support Staff

November 12, 2018 at 4:18 am

Hi Min,

I’ve had a look through the custom fields suite code and as far as I can tell it will only load on the standard WP routes, which event espresso does not use.

Within init.php it does this:

$screen = get_current_screen();

if ( is_object( $screen ) && 'post' == $screen->base ) {
    include( CFS_DIR . '/templates/admin_head.php' );
}

The Event Espresso editors do not have a base of ‘post’ so nothing loads. In order to load Custom Field Suite within EE some form of method to bypass that check would be needed, for example a filter could to be added to the above:

if ( is_object( $screen ) && 'post' == $screen->base || apply_filters('cfs_screen_base_filter', false, $screen) ) {

Which then allow you to hook in an filter that check using something like:

add_filter('cfs_screen_base_filter', 'tw_ee_cfs_screen_base_filter', 10, 2);
function tw_ee_cfs_screen_base_filter($show_cfs, $screen) {
    if ( $screen->base === 'event-espresso' ){
        return true;
    }
    return $show_cfs;
}

I’d recommend contacting the developer of the above plugin and ask them to include a filter you can use in a similar way to the above as this isn’t something we can control from within EE.


salda

November 12, 2018 at 4:46 am

Hey Tony,

Great – thank you SO MUCH for the clear and concise reply. I’ll get on to the Custom Field Suite people and see what they come back with.

Cheers,
Min


Tony

  • Support Staff

November 12, 2018 at 4:48 am

You’re most welcome.

The support post ‘Event Espresso with Custom Field Suite’ 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