Probably best would be https://github.com/CMB2/CMB2/wiki/Field-Parameters#render_row_cb where you handle the entirety of the output, including html and dynamic values.
Otherwise, I know there are tutorials out there for custom field types that you could do.
Also won’t hurt to poke around https://github.com/CMB2/CMB2-Snippet-Library/ as it has a lot of useful scaffold code.
Thanks. That worked. Now, the only problem is I’m getting a Save Changes button. I’ve tried a variety of options to make that button go away, but seem to be striking out. Any suggestions?
–David
BTW: I found https://github.com/CMB2/CMB2-Snippet-Library/edit/master/options-and-settings-pages/options-pages-with-tabs-and-submenus.php in the snippet library, which answered a whole bunch of other questions. Thanks for pointing me in that direction.
How would you save the settings if you don’t have the button?
I’m displaying seven tabs and on two of them, I’m just slamming some HTML. One is some welcome HTML with links and such, while the other is HTML with details on add-ons and tools for plugin users.
Since I don’t think CMB2 offers a way to hide the button, tabs version of an options page or no, I am curious if there’s some way you could simply use some admin-side CSS to display:none it. If the URL is different when viewing each tab, you could potentially also get an admin body class on the <body> tab so that you only hide it for one of them.
Throwing some ideas out there for you.
This worked:
// Remove primary Save button
// derived from https://github.com/CMB2/CMB2-Snippet-Library/blob/master/filters-and-actions/custom-css-for-specific-metabox.php
function myprefix_delete_welcome_button($post_id, $cmb)
{
?>
<style type="text/css" media="screen">
input#submit-cmb.button.button-primary {
display: none;
}
</style>
<?php
}
$object = 'options-page'; // could also be post | term
$cmb_id = 'myprefix_my_metabox_id';
add_action("cmb2_after_{$object}_form_{$cmb_id}", 'myprefix_delete_welcome_button', 10, 2);