shup
Forum Replies Created
-
Forum: Plugins
In reply to: [Custom Post Type UI] Conflict with Categories / Tags and Lost Meta BoxesYup my thoughts about Avada too. Not my choice!
I think it has sorted the problem though. All my meta boxes rebuilt fine after that. The capability types were handled later – so I think that is fine too, but good spot for seeing something unusual.
I’ve also worked out problem 3. Slugs had special characters in them.
Thank you for your help. Nice to have a quick response, and a second pair of eyes.
Cheers,
ShuForum: Plugins
In reply to: [Custom Post Type UI] Conflict with Categories / Tags and Lost Meta BoxesI had a quick look to see what code CPT UI would generate now and it is different to what I had several years ago. It seems to pass the theme as a parameter:
e.g.
function cptui_register_my_cpts_record() {
/**
* Post Type: Records.
*/$labels = [
“name” => __( “Records”, “Avada” ),
“singular_name” => __( “Record”, “Avada” ),
“menu_name” => __( “Records”, “Avada” ),
“all_items” => __( “All Records”, “Avada” ),
“add_new” => __( “Add New”, “Avada” ),
etcI’ve put this new code in my functions.php instead and I can now see the items in the Admin bar. So looks like I don’t need to change the post type.
Will see if I can get the meta boxes working now.
Thanks,
ShuForum: Plugins
In reply to: [Custom Post Type UI] Conflict with Categories / Tags and Lost Meta BoxesHi Michael – thanks for getting back to me.
Apologies, I didn’t post the code that was actually generated by CPT UI to register the post type. You are correct, I found the meta box code somewhere else. My mistake.
/* This is a function to register the Records Post Type */
/* Code generated from CPT UI */
/* Note – if you change any config in CPT UI then it will need to be update here too, as this overrides it *//* Enqueue child stylesheet */
add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ );
function my_theme_enqueue_styles() {
wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );}
add_action( ‘init’, ‘cptui_register_my_cpts_record’ );
function cptui_register_my_cpts_record() {
$labels = array(
“name” => __( ‘Records’, ” ),
“singular_name” => __( ‘Record’, ” ),
“menu_name” => __( ‘Records’, ” ),
“all_items” => __( ‘All Records’, ” ),
“add_new” => __( ‘Add New’, ” ),
“add_new_item” => __( ‘Add New Record’, ” ),
“edit_item” => __( ‘Edit Record’, ” ),
“new_item” => __( ‘New Record’, ” ),
“view_item” => __( ‘View Record’, ” ),
“search_items” => __( ‘Search Record’, ” ),
“not_found” => __( ‘No Records Found’, ” ),
“not_found_in_trash” => __( ‘No Records Found in Trash’, ” ),
“parent_item_colon” => __( ‘Parent Record’, ” ),
“featured_image” => __( ‘Featured Image for this Record’, ” ),
“set_featured_image” => __( ‘Set Featured Image for this Record’, ” ),
“remove_featured_image” => __( ‘Remove Featured Image from this Record’, ” ),
“use_featured_image” => __( ‘Use as Featured Image for this Record’, ” ),
“archives” => __( ‘Record Archive’, ” ),
“insert_into_item” => __( ‘Insert into Record’, ” ),
“uploaded_to_this_item” => __( ‘Uploaded to this Record’, ” ),
“filter_items_list” => __( ‘Filter Records List’, ” ),
“items_list_navigation” => __( ‘Records List Navigation’, ” ),
“items_list” => __( ‘Records List’, ” ),
“parent_item_colon” => __( ‘Parent Record’, ” ),
);$args = array(
“label” => __( ‘Records’, ” ),
“labels” => $labels,
“description” => “This is a custom post type for Records – created by Shu, 11 Oct 2016”,
“public” => true,
“publicly_queryable” => true,
“show_ui” => true,
“show_in_rest” => false,
“rest_base” => “”,
“has_archive” => true,
“show_in_menu” => true,
“exclude_from_search” => false,
//”capability_type” => “post”,
“capability_type” => “record”,
“capabilities” => array(
‘publish_posts’ => ‘publish_records’,
‘edit_posts’ => ‘edit_records’,
‘edit_others_posts’ => ‘edit_others_records’,
‘delete_posts’ => ‘delete_records’,
‘delete_others_posts’ => ‘delete_others_records’,
‘read_private_posts’ => ‘read_private_records’,
‘edit_post’ => ‘edit_record’,
‘delete_post’ => ‘delete_record’,
‘read_post’ => ‘read_record’,
),
“map_meta_cap” => true,
“hierarchical” => false,
“rewrite” => array( “slug” => “record”, “with_front” => true ),
“query_var” => true,
“menu_position” => 10,”menu_icon” => “”,
“supports” => array( “title”, “editor”, “thumbnail”, “comments”, “author” ),
“taxonomies” => array( “category”, “post_tag” ),
);
register_post_type( “record”, $args );// End of cptui_register_my_cpts_record()
}I also think there is some conflict with the theme. It was chosen by someone else. The previous theme worked with my custom post type. Does this make sense:
1) Problem 1 relates to a conflict between the custom post type and the theme, since the admin options for All and Add appear with the default theme? Can I use your CPT UI functionality to rename my custom post type, and will the “Migrate posts to newly named post type” move all record posts to the new type? I suspect, something in the theme is using “record”. Is there a way of examining a theme to see what might be conflicting?
2) The meta boxes not appearing is another problem, but if I change the custom post type above, I can try regenerating the meta boxes and form again using details from the custom post type?
3) I’m hoping the links can be regenerated with the new post type. Might be a manual process but not the end of the world.
I’m trying to find out when this started to go wrong, but I’ve not changed any settings or updated anything personally. We moved to a different host and a higher version of WordPress, but I can’t say if the problem was introduced after that.
Thanks for your help!
Shu