TypeRocket / core

TypeRocket core source files where all the magic lives.
https://typerocket.com
36 stars 21 forks source link

Add metabox to post(page) ID #8

Closed tr0yka closed 7 years ago

tr0yka commented 7 years ago

Need add metabox only to ID element.

kevindees commented 7 years ago

Hey @tr0yka

I'm not sure what you are asking about. If you can send more information about what you are trying to do that would be great. However, to use just the ID of the screen you need to use the addScreen() method.

The ID of a post type like post.

$your_id = 'post';
$box = tr_meta_box('Details');
$box->addScreen( $your_id );

Or the dashboard,

$box = tr_meta_box('Dash Details');
$box->addScreen('dashboard');

You can read all the information here was well: https://typerocket.com/docs/v3/meta-boxes/#section-dashboard-meta-box

tr0yka commented 7 years ago

@kevindees Not screen ID. Need Post ID. Ex. : $id = get_required_object_id(); or Custom set post id to add metabox. $box = tr_meta_box('Details'); $box->addScreen( $postID );

kevindees commented 7 years ago

Hey @tr0yka unfortunately the system is not designed with an API for that. You would need to add that kind of feature manually but it would not keep you from using custom fields in your own metabox. Just be sure to wrap the typerocket form in an HTML container with the class of typerocket-container like so:

<div class="typerocket-container">
<?php // add your custom fields and form here ?>
</div>