Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter gwenad

    (@gwenad)

    I just found something, in a standard wordpress them, there is no tag archive template. WordPress doesn’t seem to manage this kind of archive.
    Am i wrong?
    So i wanted to build something impossible?!

    Thread Starter gwenad

    (@gwenad)

    Thread Starter gwenad

    (@gwenad)

    Thx for your answer Gaurav Padia,

    I know that’s the way to do it, i already did it for my CPT category (named ‘movie_category’) and it works, but for some weird reason, it doesn’t work for the tags !

    I created a page with the slug “xxx.com/films/tags” (with the loop and get_terms), created a CPT tags with the rewrite slug ‘films/tags’ and ‘has_archive’ => ‘films/tags’ (the slug of the previously created page) but each time i access xxx.com/films/tag, it drives me to the index.php (even not archive.php or tag.php or the template of the page.

    Any idea ?

    Full code of my custom post type, if it can help somebody…

    register_taxonomy(
            'movie_category',
            'movie',
                array(
                    'label' => 'Categories',
                    'labels' => array(
                        'name' => 'Catégories',
                        'singular_name' => 'Catégorie',
                        'all_items' => 'Toutes les catégories',
                        'edit_item' => 'éditer la catégorie',
                        'view_item' => 'Voir la catégorie',
                        'update_item' => 'Mettre à jour la catégorie',
                        'add_new_item' => 'Ajouter une catégorie',
                        'new_item_name' => 'Nouvelle catégorie',
                        'search_items' => 'Rechercher parmi les catégories',
                        'popular_items' => 'Catégorie les plus utilisées'
                    ),
                    'show_admin_column' => true,
                    'hierarchical' => true,
                    'has_archive' => false,
                    'capability_type' => 'page',
                    'public' => true,
                    'query_var' => true,
                    'rewrite' => array(
                        'slug' => 'films',
                        'with_front' => false,
                    ),
                )
            );
    
            register_taxonomy(
            'movie_tag',
            'movie',
                array(
                    'label' => 'Tags',
                    'labels' => array(
                        'name' => 'Tags',
                        'singular_name' => 'Tag',
                        'all_items' => 'Tous les tags',
                        'edit_item' => 'éditer le tag',
                        'view_item' => 'Voir le tag',
                        'update_item' => 'Mettre à jour le tag',
                        'add_new_item' => 'Ajouter un tag',
                        'new_item_name' => 'Nouveau tag',
                        'search_items' => 'Rechercher parmi les tag',
                        'popular_items' => 'Tags les plus utilisés'
                    ),
                    'show_admin_column' => true,
                    'hierarchical' => false,
                    'has_archive' => 'films/tags',
                    'capability_type' => 'page',
                    'public' => true,
                    'query_var' => true,
                    'rewrite' => array(
                        'slug' => 'films/tags',
                        'with_front' => false,
                    ),
                )
            );
    
            register_post_type(
                'movie',
                array(
                    'label' => 'Films',
                    'labels' => array(
                        'name' => 'Films',
                        'singular_name' => 'Film',
                        'all_items' => 'Tous les films',
                        'add_new_item' => 'Ajouter un film',
                        'edit_item' => 'éditer le film',
                        'new_item' => 'Nouveau film',
                        'view_item' => 'Voir le film',
                        'search_items' => 'Rechercher parmi les films',
                        'not_found' => 'Pas de film trouvé',
                        'not_found_in_trash'=> 'Pas de film dans la corbeille'
                    ),
                    
                    'public' => true,
                    'has_archive' => false,
                    'rewrite' => array(
                        'slug' => 'films/%movie_category%',
                        'with_front' => false,
                    ),
                )
            );
Viewing 3 replies - 1 through 3 (of 3 total)