0

I used the "Custom Post Types UI" and "Custom Fields" plug-ins to set up my structure.

I have a custom post type called "artwork". This works fine. Posts have URLs like domain.cc/artwork/title-of-some-random-artwork. When I enter domain.cc/artwork, I get an archive page with all posts of the post type "artwork". That's how it should be.

Within the "Artwork" post type, I have taxonomies for "Artist", "Movie" and "Company" (connected to custom fields which can be filled in when I entered a new movie, a new artist or a new company). When I enter domain.cc/artists/name-of-an-artist, I get an archive page with all the artwork from that artist. But when I only enter domain.cc/artists, I get a 404 error. Instead, I would like to get a page with a list of all artist entries from the "artists" taxonomy.

Same problem with the "Movie" taxonomy: When I enter domain.cc/movies/some-movie-title, I get an archive page with all the artworks from that movie. Again, everything fine. But when I only enter domain.cc/movies, I get a 404 error. Instead, I would like to get a list of all movie title entries from the "movies" taxonomy.

I googled for hours, but couldn't find a solution.

Thank you for your help!

3
  • You need to activate archive option on Custom Post UI on you custom post Commented Apr 6, 2020 at 6:46
  • Yes, I already activated this. It works with the custom posts, as described in the original post. But there is no such option when you create a new taxonomy in Custom Post UI (the option is only there when you create a new custom post type).
    – HAL2020
    Commented Apr 6, 2020 at 7:13
  • Unfortunately, taxonomies by default do not have any archives which lists posts in any terms in the taxonomy. You'll need to use custom SQL for that, and possibly with custom URL rewriting. Or you can create a Page (e.g. with the slug artists) and run a custom WP_Query loop in the Page template.
    – Sally CJ
    Commented Apr 6, 2020 at 14:27

1 Answer 1

0

I solved it with this workaround. I created a new page ("Movies" with the URL domain.cc/movies) and added this via shortcode:

<?php
     $taxonomy = 'artists';
     $tax_terms = get_terms( $taxonomy, array(
    'post_type' => 'artwork',
    'orderby' => 'name',
    'order' => 'ASC' 
     ) );
 ?>
 <?php
     foreach ($tax_terms as $tax_term) {
 ?><div class="artistslist">
     <a href="/<?php echo $taxonomy;?>/<?php echo $tax_term->slug;?>"><?php echo $tax_term->name;?>
     </div>
 <?php } ?>

Now I can access artist archives via domain.cc/artists/some-artist-name, and an A-Z list of all artists on domain.cc/artists

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.