WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Can't make my custom pages showing CPT by Taxonomy (2 posts)

  1. Cedric
    Member
    Posted 1 year ago #

    Hi everyone, this is my first post here as I just did my first theme and I'm amaze by the quantity of information we can find here! Keep up the good work, WordPress is amazing.

    Here is my situation.

    I did a WordPress theme for my University art gallery. There is the exhibitions section which is 3 pages (Current, Upcoming and Archive). Here is what I thought it would be the way to go:

    - A CPT called Exhibitions with its own page (page_exhibitions.php)
    - Taxonomy for when are the Exhibitions (Current, Upcoming and Archive). (called when)
    - Taxonomy for where is the Exhibitions (Main Gallery, Corridor and Vitrine).(called where)

    So far, it work fine, I create 2 new Exhibitions posts and they show in the exhibitions page. Now I struggle with this specific page (page_exhibitions.php). It shows the post well but I need that it list only the current Exhibitions by where they are like:

    Main Gallery:
    - blablabla
    Vitrine:
    - blablabla
    Corridor:
    - blablabla

    Then, when the user select Archive in the main menu, Its shows all the past Exhibitions and same thing for Upcoming.

    I don't know how to target specific taxonomy, for now all the Exhibitions are shown in the Exhibitions page...

    I don't know what I could provide to help understand my concern, If you need to see my codes, there is no problems.

    thanks!

  2. Cedric
    Member
    Posted 1 year ago #

    Well, I figured out, I just needed to REALLY look at the codex in WP_query... I did this to get current exhibition:

    '?php $args = array('post_type' => 'exhibition', 'when' => 'current',);?>'

    And '<?php echo get_the_term_list( $post->ID, 'where', '', ', ', '' ); ?>' To see where they are.

    That Codex is intimidating but once we read, it is pretty functional! :)

    Thank you guys.

Topic Closed

This topic has been closed to new replies.

About this Topic