Add multiple custom meta boxes to different custom post types

The add_meta_box() functions 4th parameter is where you add your CPT’s for the backend. $post_type (string) (required) The type of Write screen on which to show the edit screen section (‘post’, ‘page’, ‘dashboard’, ‘link’, ‘attachment’ or ‘custom_post_type’ where custom_post_type is the custom post type slug) You should be able to add an array for multiple … Read more

Help with my first Metabox helper class

The problem seems on the line no 279 of metabox class api definition, below is your code: ‘<img src=”‘.$label.'” class=”optionimg ‘.$selected_value.'” onclick=”document.getElementById(\ ”.$field[‘id’].$choices.’\’).checked=true” style=”display:inline-block;” /><input type=”radio” name=”%s” id=”%s” value=”%s” style=”display:none;”/>’, $choices is not defined variable in the scope (error thrown by WAMP), I think you should replace $field[‘id’].$choices with $value as in below code: ‘<img … Read more

Display multiple “save draft button” on a post edit

One really simple way is to just insert another “save draft” button wherever you want in your post editor page. <input type=”submit” name=”save” value=”Save Draft” class=”button”> You essentially just want to make sure it’s got “save” as it’s name attribute and “Save Draft” as it’s value.

WPAlchemy Metabox rewriting slug

So the solution after much cursing and pulling of hair was to ditch the WP_Query and go with get_posts instead, while referencing post_title like so: <div class=”my_meta_control”> <p>Add or subtract Athena projects related to this project.</p> <label>Available Projects</label><br/> <?php $args = array(‘post_type’ => ‘athena_project’, ‘posts_per_page’ => 1000); $items = get_posts($args); $mb->the_field(‘item’, WPALCHEMY_FIELD_HINT_CHECKBOX_MULTI); foreach ($items as … Read more

Set post title to same value as a tow meta box

Why do you need to remove the title? Generally it’s a bad idea, as the title generates the permalink, can’t think of any scenario where it would be necessary. Anyways, here is some code that looks like it does what you need: function add_custom_title( $data, $postarr ) { if($data[‘post_type’] == ‘myposttype’) { if(empty($data[‘post_title’]) { // … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)