Meta box checkbox won’t save

I found the answer now it was the way i was trying to save it this is what I done in the save function if( isset( $_POST[ ‘ck_sale_item’ ] ) ) { update_post_meta( $post_id, ‘ck_sale_item’, ‘on’ ); } else { update_post_meta( $post_id, ‘ck_sale_item’, ‘off’ ); }

Get all Custom Post Types

Easy list filtering There’s the global $wp_post_types which is used for e.g. in get_post_type_object( $name );, register_post_type(), etc. If you want to omit the ones delivered with core, you should filter the returned list and skip everything that has the _builtin key set to true. Just use wp_list_filter() for that $cpts = wp_list_filter( $GLOBALS[‘wp_post_types’], array( …

Read more

How to show/hide a meta box using categories, with a different post type

Instead of if (is_admin()) add_action(‘admin_menu’, ‘add_custom_box’); use add_action(‘add_meta_boxes’, ‘add_custom_box’); The ‘add_meta_boxes’ hook is the correct one to add meta boxes. Other than that, as you mentioned correctly change the ‘post’ to ‘$my-custom-post-type’ and register the category taxonomy for that post type: register_taxonomy_for_object_type( ‘category’, ‘$my-custom-post-type’ )

Using Meta Boxes in a Custom Page Template

By default WordPress doesn’t load admin classes/function definitions in the front end of the site. You need to explicitly require the files. As far as I remember requiring wp-admin/includes/admin.php would get you most of typical stuff.

Some comment box wordpress in 1 post [closed]

Yes it is possible but not exactly trivial or well documented. The easiest option is to have different comment types (ie, have new ones in addition to the traditional comment, pingback and tracback). The biggest problem with this approach is that most of wordpress API and admin is not built to be flexible enough to …

Read more