Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metabox title/description don't show on taxonomy term pages #551

Closed
MickeyKay opened this issue Dec 21, 2015 · 4 comments
Closed

Metabox title/description don't show on taxonomy term pages #551

MickeyKay opened this issue Dec 21, 2015 · 4 comments

Comments

@MickeyKay
Copy link

Neither the title nor description fields appear to be outputting when using CMB2 metaboxes with WordPress 4.4's new term meta functionality.

Update
This issue relates specifically to the cmb2-rest-api branch.

@jtsternberg
Copy link
Member

I suggest using the 'title' field type to output titles (and the description attribute on that title field to output a description). It works the same way for user meta as well.

@MickeyKay
Copy link
Author

Sorry, should've been clearer here. I was racing along to get things done and didn't leave you much to work with. Keep in mind this is referring to the cmb2-rest-api branch specifically. What I'm referring to are the title and description args passed to the new_cmb2_box() call. Here's my code:

public function register_category_related_content_metabox() {

    // Start with an underscore to hide fields from custom fields list
    $prefix = "_{$this->plugin_slug}_";

    $metabox = new_cmb2_box( array(
        'id'           => $prefix . 'related-content-group',
        'title'        => __( 'TITLE', 'my-slug' ),
        'description'        => __( 'DESCRIPTION', 'my-slug' ),
        'object_types' => array( 'term' ),
        'taxonomies'   => array( 'category', 'post_tag' ),
    ) );

    $metabox->add_field( array(
        'name'             => __( 'Related Content Group', 'my-slug' ),
        'id'               => $prefix . 'related-content-group',
        'type'             => 'select_related_content_group',
        'options_cb'       => array( $this, 'get_related_content_type_groups' ),
        'show_option_none' => __( '- None -', 'my-slug' ),
    ) );

}

And here's what outputs on taxonomy term pages:
image

As you can see, the metabox title and description are not outputting at all.

@jtsternberg
Copy link
Member

Yes, I understood. As i mentioned, that is how it has always been when using CMB2 anywhere but in an actual metabox. User/Term meta fields do not live in a metabox, but are standalone fields. If you want to create that separation, use the 'title' field type.

@MickeyKay
Copy link
Author

Got it. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants