Add custom meta box on Post page

You need to use the add_meta_box function add_action( ‘add_meta_boxes’, ‘my_custom_meta_box’ ) ); function my_custom_meta_box(){ $args = array(); add_meta_box( ‘my_metabox_id’, __( ‘My Meta Box’, ‘my_textdomain’ ), // Title ‘my_callback_function’, // Callback function that renders the content of the meta box ‘post’, // Admin page (or post type) to show the meta box on ‘side’, // Context … Read more

How can i add a metabox to pull list of custom posts (any two) on edit or add post screen?

You can add a metabox in the edit screen with add_action( ‘add_meta_boxes’, function () { add_meta_box( ‘yourcustom_sectionid’, __( ‘👋 Custom Meta Box’, ‘yourtextdomain’ ), function ( $post ) { wp_nonce_field( plugin_basename( __FILE__ ), ‘yourcustom_noncename’ ); $cstm = get_post_meta(get_the_ID(),’yourcustom_meta’,true); echo “<pre>”.print_r($cstm,true).”</pre>”; }, ‘page’ ); } ); You can query posts with get_posts() and add some check … Read more

How To Create a Metabox of HTML Content with Instructions For Editors When Editing a Post or Page?

Don’t know any plugin for that. But it can be solved creating a custom plugin with the Settings API and a Custom Meta Box. Adding a RichText Editor in the Settings Page /wp-admin/options-general.php <?php /* Plugin Name: Custom Editor in Settings Page */ add_action( ‘admin_init’, ‘register_settings_wpse_57647’ ); # Register settings function register_settings_wpse_57647() { register_setting( ‘general’, … Read more

Unbind postbox click handler

You can just put the necessary javascript in a file and enqueue it on the necessary page: add_action( ‘admin_enqueue_scripts’, ‘add_admin_scripts’, 10, 1 ); function add_admin_scripts( $hook ) { //You can globalise $post here and enqueue the script for only certain post-types. if ( $hook == ‘post-new.php’ || $hook == ‘post.php’) { wp_register_script( ‘my_js_handle’,’/path/to/js/my-js-file.js’,array(‘jquery’),1,true); wp_enqueue_script(‘my_js_handle’); } … Read more

Priority of Meta Box for Custom Post Type

Where you have the parameter ‘normal’ eg. the context parameter change that to read ‘core’. add_meta_box(‘cpt_meta’, ‘Meta Box’, ‘cpt_meta’, ‘cpt_function’, ‘core’, ‘high’); The default meta boxes are registered as core and are listed first, followed by the ‘normal’ context. The docs don’t actually say you can do it but I have done without any problems. … Read more

Is there a predefined callback function for custom categories?

The callback you’re looking for is post_categories_meta_box which we can use via a custom callback. // Add your custom meta box. function your_custom_meta_box() { add_meta_box( ‘your-custom-meta-box’, ‘Custom Meta Box’, ‘my_taxonomy_meta_box_cb’, ‘post’, ‘side’, ‘high’, null ); } add_action( ‘add_meta_boxes’, ‘your_custom_meta_box’ ); // Our custom callback. function my_taxonomy_meta_box_cb( $post, $box ) { // Pass in the taxonomy … Read more

How do I stop HTML entities in a custom meta box from being un-htmlentitied?

If I’m allowed to answer my own question here: I found a way to stop the conversion of my html entities back to characters by using <?php esc_textarea( $text ) ?>, as detailed by the codex here: http://codex.wordpress.org/Function_Reference/esc_textarea. Not sure if this is the right way of doing it, but its working. My (snipped) metabox … Read more

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