I have created a custom post type with php and my problem is that this post type is not appearing in the menu of Toolset Types Plugin. I think that must be some option that I have to fill but I have tried with almost everything and I don´t know why this is happening.
I want to edit the relationship between post types, specially between cars and news.
My code to create the custom post type is this.
function car_post_type() {
$labels = array(
'name' => 'Coches',
'singular_name' => 'Coche',
'menu_name' => 'Coches',
'name_admin_bar' => 'Coches',
'parent_item_colon' => 'Padre:',
'all_items' => 'Todos los coches',
'add_new_item' => 'Añadir nuevo coche',
'add_new' => 'Añadir coche',
'new_item' => 'Nuevo coche',
'edit_item' => 'Editar coche',
'update_item' => 'Actualizar coche',
'view_item' => 'Ver coche',
'search_items' => 'Buscar coches',
'not_found' => 'No hay resultados',
'not_found_in_trash' => 'No se han encontrado coches en la papelera',
);
$rewrite = array(
'slug' => 'coche',
'with_front' => true,
'pages' => true,
'feeds' => true,
);
$args = array(
'label' => __( 'Car', 'clever' ),
'description' => __( 'Cars', 'clever' ),
'labels' => $labels,
'supports' => array(
'title', 'editor', 'excerpt', 'thumbnail', 'revisions',
),
'taxonomies' => array(),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-dashboard',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'rewrite' => $rewrite,
'capability_type' => 'post',
);
register_post_type('car', $args);
}
add_action('init', 'car_post_type', 0);
Thanks for your help.
get_post
/WP_Query
calls are all good. I would look into how the plugin creates its list of post types. Does it even allow for custom post types?get_option( WPCF_OPTION_NAME_CUSTOM_TYPES, array() );
search the plugin directory for that line and you will see what I mean. There is a filter you can hook though:$data = apply_filters( 'types_post_type', $data, $post_type );
at the top ofwpcf_custom_types_register()
in /library/toolset/types/embedded/includes/custom-types.php line 223