0

I am about to write a custom plugin that is intended to »extend« a third party plugin, in this case it is: »EME Events made Easy«. I would like to add a Metabox to the »edit event« screen, from within my plugin, so that I do not have to modify the events-plugin code.

How can I do that?

Thanks in ahead, philipp

EDIT

Since my Questions seems to lack some details I am gonna add them now:

I have installed and actived the Plugin: »EME Events made easy«. In the admin section, I can navigate to: wp-admin/admin.php?page=events-manager&action=edit_event&event_id=<some_id>

I would like to add a Meta Box to this page, so that I am able to store meta data for each event. There are some hooks, shown here, I can use to actually store the data.

So far I have written a Plugin, which also activated and running and I am searching for a way to display the metabox, or inject some custom html at a suitable hook.

I have tried:

function sw_contact_add_events_meta_boxes()
{
    add_meta_box( 'css-id', 'my-title', 'sw_contact_display_meta', 'events-manager', 'advanced', 'high', array() );
}
add_action( 'add_meta_boxes', 'sw_contact_add_events_meta_boxes' );

function sw_contact_display_meta( $test )
{
    die();
}

but the page did not die, so the hook did not work.

0

Register the metabox for just one post type with add_meta_boxes_$post_type:

add_action( 'add_meta_boxes_event', function()
{
    add_meta_box(
        'wpse_118766_box',
        'Custom Box',
        'wpse_118766_render_box' // function to render the box
    );
});

function wpse_118766_render_box( $post )
{
    echo 'hello';
}
| improve this answer | |
  • no, the add Meta box hook is not called. I guess that the event-edit-page, or all events are no custom post types. But how can I inject some HTML on this (only on this) page? Is there any other event I can hook in? – philipp Oct 14 '13 at 9:24
  • @philipp Add the code registering the events to your question. – fuxia Oct 14 '13 at 9:25
  • I just used the code you have posted above. (copied and pasted it to my plugin which already activated) – philipp Oct 14 '13 at 9:29
  • My code doesn’t register the events, the plugin does. We need that code to help you. – fuxia Oct 14 '13 at 9:49
  • To confirm what @philipp already suspected, EME does not use custom post types for events so this is going to prevent adding meta boxes using the standard method. – TomC Dec 17 '19 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.