WordPress.org

Forums

CPT-onomies: Using Custom Post Types as Taxonomies
[resolved] Custom Meta Box Title (2 posts)

  1. deanosaurus
    Member
    Posted 1 year ago #

    I don't know if it is already possible and I am just overlooking it, but can you add a custom title for the meta box that appears for a CPT-onomy?

    I have two CPT-onomies that I want to relate to each other 'People' and 'Group'. People can belong to many Groups, but a Group has one "Leader" (person) and I was hoping to change the dropdown meta box to have the title "Leader" in place of "People" which is the default. If there already is a way or a work around please let me know!

    https://wordpress.org/plugins/cpt-onomies/

  2. Rachel Carden
    Member
    Plugin Author

    Posted 1 year ago #

    A workaround doesn't currently exist but is easy to implement. I've added it for the next update so, in the meantime, open your admin.php file, find the add_cpt_onomy_meta_boxes() function in the CPT_ONOMIES_ADMIN class and replace the add_meta_box() call with the following code:

    add_meta_box( CPT_ONOMIES_DASH.'-'.$taxonomy, apply_filters( 'custom_post_type_onomies_meta_box_title', __( $tax->label, CPT_ONOMIES_TEXTDOMAIN ), $taxonomy, $post_type ), array( &$this, 'print_cpt_onomy_meta_box' ), $post_type, 'side', 'core', array( 'taxonomy' => $taxonomy ) );

    Then use the 'custom_post_type_onomies_meta_box_title' filter to change the title to whatever you like.

    I'm also adding a "Meta Box Title" property to the settings page so you'll be able to take advantage of that when I update and get rid of your filter if you like.

    Hope that makes sense. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic