The following snippet shows how to access and modify the Broadcast meta box, adding the blog’s ID after each blog name in the list.
/**
@brief Add the blog ID to the blog list in the Broadcast meta box.
@since 2017-05-16
**/
function my_threewp_broadcast_prepare_meta_box( $action )
{
$mbd = $action->meta_box_data;
// Retrieve the form for the meta_box_data.
if ( ! isset( $mbd->form ) )
return;
$form = $mbd->form;
// Retrieve the blogs fieldset (=checkboxes).
$blogs = $form->checkboxes( 'blogs' );
if ( ! $blogs )
return;
// Retrieve the blogs, which are inputs in the blogs fieldset.
$blog_inputs = $blogs->inputs;
foreach( $blog_inputs as $blog_input )
{
$old_label = $blog_input->get_label();
// The label is an HTML element, from the Plainview SDK.
// Extract the content.
$old_label = $old_label->content;
// The name of the input is blog_XX
$blog_id = $blog_input->get_name();
$blog_id = str_replace( 'blogs_', '', $blog_id );
// Add a blog ID to the label.
$new_label = $old_label . ' (' . $blog_id . ')';
// And change the label.
$blog_input->label( $new_label );
}
}
add_action( 'threewp_broadcast_prepare_meta_box', 'my_threewp_broadcast_prepare_meta_box' );