changes custom post type label to mid slash

This commit is contained in:
jorge 2022-12-28 19:12:18 +01:00
parent f7b3afa247
commit 8cc6c2279e
1 changed files with 10 additions and 10 deletions

View File

@ -56,13 +56,13 @@
// 'delete_private_posts' => 'delete_private_ajuts'
// );
$args = array(
'label' => __( 'ofisuport_ajut', 'text_domain' ),
'label' => __( 'ofisuport-ajut', 'text_domain' ),
'description' => __( 'Ajuts', 'text_domain' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', 'trackbacks', 'revisions', 'custom-fields', 'page-attributes' ),
'taxonomies' => array(
'ofisuport_ajut_category',
'ofisuport_ajut_tag'
'ofisuport-ajut-category',
'ofisuport-ajut-tag'
),
'hierarchical' => true,
'public' => true,
@ -82,7 +82,7 @@
//'capabilities' => $capabilities,
'map_meta_cap' => true //neded to apply the new capabilities.
);
register_post_type( 'ofisuport_ajut', $args );
register_post_type( 'ofisuport-ajut', $args );
}
// Hook into the 'init' action
add_action( 'init', 'ofisuport_wpplugin_custom_post_ajut_init', 0 );
@ -158,7 +158,7 @@
// 'map_meta_cap' => true //neded to apply the new capabilities.
// );
// register_taxonomy( 'ofisuport_ajut_category', array( 'ofisuport_ajut' ) , $args );
// register_taxonomy( 'ofisuport-ajut-category', array( 'ofisuport-ajut' ) , $args );
//}
// Hook into the 'init' action
@ -207,7 +207,7 @@
// //'capabilities' => $capabilities,
// 'map_meta_cap' => true //neded to apply the new capabilities.
// );
// register_taxonomy( 'ofisuport_ajut_tag', array( 'ofisuport_ajut' ) , $args );
// register_taxonomy( 'ofisuport-ajut-tag', array( 'ofisuport-ajut' ) , $args );
// }
// Hook into the 'init' action
@ -217,7 +217,7 @@
// https://wordpress.stackexchange.com/questions/108642/permalinks-custom-post-type-custom-taxonomy-post
// change in register_post_type the slug 'rewrite' to this
// $rewrite = array(
// 'slug' => 'ajuts/%ofisuport_ajut_category%',
// 'slug' => 'ajuts/%ofisuport-ajut-category%',
// 'with_front' => true,
// 'hierarchical' => true,
// );
@ -225,10 +225,10 @@
//
// function ofisuport_wpplugin_ajut_and_category_permalink( $post_link, $id = 0 ){
// $post = get_post($id);
// if ( is_object( $post ) && $post->post_type == 'ofisuport_ajut' ){
// $terms = wp_get_object_terms( $post->ID, 'ofisuport_ajut_category' );
// if ( is_object( $post ) && $post->post_type == 'ofisuport-ajut' ){
// $terms = wp_get_object_terms( $post->ID, 'ofisuport-ajut-category' );
// if( $terms ){
// return str_replace( '%ofisuport_ajut_category%' , $terms[0]->slug , $post_link );
// return str_replace( '%ofisuport-ajut-category%' , $terms[0]->slug , $post_link );
// }
// }
// return $post_link;