Save an array from drop-down in custom meta box

Quite simple. Instead of saving the post title, save the post ID, so in the front end you can extract all necessary info. Like so: get_post( $the_saved_ID_value ); or get_permalink( $the_saved_ID_value );. In you code, change this line: echo ‘<option value=”‘.get_the_ID().'” ‘.$is_selected.’>’.get_the_title().'</option>’; Notes: Using a WP_Query seems a bit too much, consider get_posts. Lots of … Read more

Show how many images are attached to a post/page on compose page

add_action( ‘add_meta_boxes’, ‘attached_images_meta’ ); function attached_images_meta() { $screens = array( ‘post’, ‘page’ ); //add more in here as you see fit foreach ($screens as $screen) { add_meta_box( ‘attached_images_meta_box’, //this is the id of the box ‘Attached Images’, //this is the title ‘attached_images_meta_box’, //the callback $screen, //the post type ‘side’ //the placement ); } } function … Read more

How to hide a plugin metabox for non admins when a user adds a new post

You can try to add this line to your code example for the admin_menu filter: remove_meta_box(‘awd_fcbk_awd_mini_form_metabox’, ‘post’, ‘side’); where awd_fcbk is the plugin slug. Edit: This is the metabox that I’m targeting from the plugin source code: //Like button manager on post page type add_meta_box($this->plugin_slug . “_awd_mini_form_metabox”, __(‘Facebook AWD Manager’, $this->ptd) . ‘ <img style=”vertical-align:middle;” … Read more

Create custom PAGE with register_post_type

Your screenshot seems to indicate that you’re interested in the status message for your custom post type saying ‘Page updated. View page’. If that’s true, the reason that you’re getting ‘Post updated. View post’ is that you haven’t provided status messages for your custom post type. Here’s the code for the admin edit page (edit-form-advanced.php): … Read more

Customize Plugin

Your update_option should be inside a hook callback and should check to see if $_POST[‘custom_welcome_panel’] is set before trying to update the option. Otherwise that could be overwriting your option every time the page loads. And, honestly, as written I could shove anything I wanted into that option value. I’d just have to send a … Read more

Convert textarea with wp_editor

This is was I use to convert textarea with wp_editor() wp_editor($value, “editor-name”, array( ‘tinymce’ => array( ‘theme_advanced_buttons1’ => ‘bold,italic,underline’, ‘theme_advanced_buttons2’ => ”, ‘theme_advanced_buttons3’ => ” ) ));

How to Put Custom Taxanomy Meta Box in Main Column

Unfortunately WP is hardcoded to generate taxonomy metaboxes in that side location. It is tad fragile, but possible to throw generated data around from one location to another: add_action( ‘add_meta_boxes’, ‘move_taxonomy_metabox’ ); function move_taxonomy_metabox() { global $wp_meta_boxes; $taxonomy = ‘test’; $metabox_key = ‘tagsdiv-‘ . $taxonomy; // or $taxonomy . ‘div’ if hierarhical if ( isset( … Read more

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