Skip to content

Instantly share code, notes, and snippets.

@thierrypigot
Created December 19, 2022 14:47
Show Gist options
  • Save thierrypigot/922547bc37f1309fe6a6deebc07c8262 to your computer and use it in GitHub Desktop.
Save thierrypigot/922547bc37f1309fe6a6deebc07c8262 to your computer and use it in GitHub Desktop.
<?php
// Create a new "Heures d'ouverture" taxonomy
function create_opening_hours_taxonomy() {
$labels = array(
'name' => _x( 'Heures d'ouverture', 'taxonomy general name', 'textdomain' ),
'singular_name' => _x( 'Heure d'ouverture', 'taxonomy singular name', 'textdomain' ),
'search_items' => __( 'Rechercher des heures d'ouverture', 'textdomain' ),
'all_items' => __( 'Toutes les heures d'ouverture', 'textdomain' ),
'parent_item' => __( 'Heure d'ouverture parente', 'textdomain' ),
'parent_item_colon' => __( 'Heure d'ouverture parente:', 'textdomain' ),
'edit_item' => __( 'Modifier l'heure d'ouverture', 'textdomain' ),
'update_item' => __( 'Mettre à jour l'heure d'ouverture', 'textdomain' ),
'add_new_item' => __( 'Ajouter une heure d'ouverture', 'textdomain' ),
'new_item_name' => __( 'Nouvelle heure d'ouverture', 'textdomain' ),
'menu_name' => __( 'Heures d'ouverture', 'textdomain' ),
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'opening-times' ),
);
register_taxonomy( 'opening_times', array( 'post' ), $args );
}
add_action( 'init', 'create_opening_hours_taxonomy', 0 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment