List all sidebars in metabox

The class you are using accepts value => name pair in the select options array so foreach ( $GLOBALS[‘wp_registered_sidebars’] as $sidebar ) { $sidebar_options[$sidebar[‘id’]] = $sidebar[‘name’]; } and then you can use $sidebar_options.

Meta-Boxes for CustomPostType cause PHP Errors and Notices in “Add New” view

Start by reading the notices–they tell you very explicitly what the problem is. Let’s start with the first one: Notice: Undefined index: _wr_event_speaker in /Users/my/htdocs/wr/wp-content/themes/wr/functions.php on line 246 First, this is just a “notice”. Meaning that no error has actually occurred. PHP is just telling you that something isn’t quite right, but that it skipped … Read more

Display Content if Meta Checkbox is checked?

First make the custom post query with the WP_Query, and then we get the metadata by get_post_meta. Checkboxses are saved as boolean, that means either true or false. So make a check in the loop if checked or not (1=true, 0=false). <?php get_header(); ?> <?php // The Query $the_query = new WP_Query( array( ‘post_type’ => … Read more

Limit checklist by the current user

Use the same technique as $checked: $disabled = ( $ed->ID != get_current_user_id() ) ? ‘ disabled=”disabled”‘ : ”; your code: foreach ($alleds as $ed) { $checked = (in_array($ed->ID,(array)$currenteds)) ? ‘ checked=”checked”‘ : ”; $disabled = ( $ed->ID != get_current_user_id() ) ? ‘ disabled=”disabled”‘ : ”; echo ‘<input type=”checkbox” name=”currenteds[]” value=”‘ . $ed->ID . ‘”‘ . … Read more

Add additional field to custom post_type

In your code, you are using: add_filter( ‘team_Meta_Box’, ‘team_sample_metaboxes’ ); On the site you linked to, they are using: add_filter( ‘cmb_meta_boxes’, ‘wpb_sample_metaboxes’ ); So my question is: did you change all instances of “cmb” to “team” in the init.php file? If you did, then the correct filter to use should be: add_filter( ‘team_meta_boxes’, ‘team_sample_metaboxes’ ); … Read more