I know I must be doing something wrong when setting the custom post type “productos” as it can’t find the post url when going to the product specific page, the product page is also “productosv2”,
Code in functions.php
function create_posttype() {
register_post_type( 'productos',
// CPT Options
array(
'labels' => array(
'name' => __( 'Productos' ),
'singular_name' => __( 'Producto' )
),
'public' => true,
'has_archive' => false,
'rewrite' => array('slug' => 'productosv2'),
)
);
}
// Hooking up our function to theme setup
add_action( 'init', 'create_posttype' );
/* Custom Post Type End */
/*Custom Post type start*/
function cw_post_type_productos() {
$supports = array(
'title', // post title
'editor', // post content
'author', // post author
'thumbnail', // featured images
'excerpt', // post excerpt
'custom-fields', // custom fields
'comments', // post comments
'revisions', // post revisions
'post-formats', // post formats
);
$labels = array(
'name' => _x('productos', 'plural'),
'singular_name' => _x('producto', 'singular'),
'menu_name' => _x('Productos', 'admin menu'),
'name_admin_bar' => _x('productos', 'admin bar'),
'add_new' => _x('Añadir nuevo', 'añadir nuevo'),
'add_new_item' => __('Add New productos'),
'new_item' => __('Nuevo productos'),
'edit_item' => __('Editar productos'),
'view_item' => __('Ver productos'),
'all_items' => __('Todos los productos'),
'search_items' => __('Buscar productos'),
'not_found' => __('No se han encontrado productos.'),
);
$args = array(
'supports' => $supports,
'labels' => $labels,
'public' => true,
'query_var' => true,
'rewrite' => array('slug' => 'productosv2'),
'has_archive' => true,
'hierarchical' => true,
//'taxonomies' => array( 'productos_tipos' ),
);
register_post_type('productos', $args);
}
add_action('init', 'cw_post_type_productos');
/*Custom Post type end*/
// añadir taxonomía
add_action( 'init', 'build_taxonomies', 0 );
function build_taxonomies() {
register_taxonomy(
'productos_tipos',
'productos', // this is the custom post type(s) I want to use this taxonomy for
array(
'hierarchical' => true,
'label' => 'Tipo de Productos',
'query_var' => true,
'rewrite' => true
)
);
}
The page I need help with: [log in to see the link]