Support

Home Forums Event Espresso Premium Custom events meta boxes

Custom events meta boxes

Posted: August 6, 2014 at 5:38 am


Shelomo Dobkin

August 6, 2014 at 5:38 am

Hi,

I’m trying to add a custom meta boxes to the events page, but I can’t seem to find a hook for it. I have trying the regular load-post.php and load-post-new.php but it’s not showing up, any suggestions?

Thanks,
Shelomo


Dean

August 6, 2014 at 6:01 am

Hi,

If you just wish to use Custom Fields, they are already active within an event. If they are not showing, check the Screen Options.

If you are using add_meta_box(), then you need to make sure you have added the post_type as ‘espresso_events’ within the function.

If you take the first example here http://codex.wordpress.org/Function_Reference/add_meta_box then the $screen would be replaced with ‘espresso_events’

Screenshot of custom meta box on event http://take.ms/W6NyK


Shelomo Dobkin

August 7, 2014 at 5:07 pm

Thanks Dean for your help!
I did add that and I still don’t see the box appearing on the page.
Here is my code:

add_action( 'load-post.php', 'fundcode_meta_boxes_setup' );
add_action( 'load-post-new.php', 'fundcode_meta_boxes_setup' );

function fundcode_meta_boxes_setup() {
  add_action( 'add_meta_boxes', 'fundcode_add_meta_boxes' );
}

function fundcode_add_meta_boxes() {
  add_meta_box(
    'fundcode-occasion', 
    esc_html__( 'Occasion', 'event_espresso' ), 
    'fundcode_occasion_meta_box', 
    'espresso_events', 
    'side', 
    'default'  
  );
}


Dean

August 7, 2014 at 11:37 pm

Hi,

Lose the following:

add_action( 'load-post.php', 'fundcode_meta_boxes_setup' );
add_action( 'load-post-new.php', 'fundcode_meta_boxes_setup' );

function fundcode_meta_boxes_setup() {
  add_action( 'add_meta_boxes', 'fundcode_add_meta_boxes' );
}

and just use

add_action( 'add_meta_boxes', 'fundcode_add_meta_boxes' );


Shelomo Dobkin

August 8, 2014 at 8:04 am

WOW! Thank you so much!!!

The support post ‘Custom events meta boxes’ 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