Get post related to particular meta box? [closed]

Something along the lines of: $args = array( ‘posts_per_page’ => 10, ‘post_type’ => ‘post’, ‘meta_key’ => ‘METAkeyNAME’, //what I assume you’ve called a meta box ‘meta_value’ => ‘THEdesiredVALUE’, ‘orderby’ => ‘ID’, //choose to order by anything look here [http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters] for more info ‘order’ => ‘ASC’, ); $results = new WP_Query($args); // ‘<pre>’.print_r($results).'</pre>’; // This is … Read more

Dynamically replicate custom metabox in custom post type

please try this code. this code will create meta boxes dynamically <?php add_action( ‘add_meta_boxes’, ‘dynamic_add_custom_box’ ); /* Adds a box to the main column on the Post and Page edit screens */ function dynamic_add_custom_box() { add_meta_box( ‘dynamic_sectionid’, __( ‘Shortcode Information’, ‘myplugin_textdomain’ ), ‘dynamic_inner_custom_box’, ‘post’);} Please add slug name of Custom post in above function in … Read more

Adding a metabox shortcode “paypal accept payment” in my custom post type back-end

Add this to your child theme / plugin functions.php. I think this should do the trick. Let me know function your_meta_callback( $post ) { echo Paypal_payment_accept(); } add_meta_box( ‘your_meta’, __( ‘Meta Box Title’, ‘your-textdomain’ ), ‘your_meta_callback’, ‘your-posttype-name’, ‘side’ ); For more information see WordPress Codex on add_meta_box(). Update: Ok I have looked into this. If … Read more

Error showing in current page id in wordpress admin

While front–end of the site always has a post context (you are either looking at one or archive of posts), admin side doesn’t. So plenty of admin screens won’t have $post global set to anything. You should be checking if it’s meaningful (for example by if ( ! empty( $post ) )) before trying to … Read more

Adding JS functionality to the Publish button in wp-admin/post.php

Solved it by using a modal box instead of metabox, forcing the users to finish editing the plugin data, before submitting the regular changes to WP. //add_action( ‘add_meta_boxes’, array( $this, ‘add_custom_metabox’ ) ); add_action( ‘media_buttons_context’, array($this, ‘add_custom_media_buttons’ ) ); add_action( ‘admin_footer’, array($this, ‘add_esm_edit’ ) ); These were the lines that were added to the __construct(). … Read more