Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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';
}
share|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. –  toscho 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. –  toscho Oct 14 '13 at 9:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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