Add Metabox to all custom post types

The 4th parameter for add_meta_box() is the post_type. So if you’re calling it with post, it’ll only show on WordPress’s native posts. Try this: add_meta_box( ‘my-meta-box-id2’, ‘Enter your PDF location for your post category below:’, ‘cd2_meta_box_cb’, ‘your_custom_post_type_name’, ‘normal’, ‘high’ ); If you have multiple post types you’d like to attach this to, this should work: … Read more

Adding meta boxes to custom post type

Let’s say your post type is named product. You register your metabox with … add_action( ‘add_meta_boxes_product’, ‘register_product_metabox’ ); function register_product_metabox() { // register the metabox } You get the post id in your callback per post object now: function metabox_callback( $post ) { $field = get_post_meta( $post->ID ); } This happens because WordPress calls the … Read more

Problems with a custom meta_box

You are not including any previously set values in the input field. $value = get_post_meta($post_id->ID,’event-link’,true); <input type=”text” style=”padding:10px;” value=”‘.$value.'” name=”event-link”/> Note that the meta box callback get a post object not just an ID. Additionally, you are not saving your fields at all. Instead you are saving either 1 or 0. If you want to … Read more

Advanced Custom Field User Help URL

I have this exact thing working on a current project. Here’s the code: <div class=”photo-feature” style=”background: url(<?php the_field(‘the-image’, $page->ID) ;?>) no-repeat center center; “></div> Keep in mind a couple of things: You may need to use $post->ID or $page->ID if you’re using a custom query. Make sure you’re not overriding your background CSS anywhere else … Read more

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