Support » Fixing WordPress » How to query custom post type categories in multiple loops

  • Resolved kblakesd

    (@kespinoza)


    I have created custom post types organized as “programs” with three different categories and am setting up the page to have three columns so that category a is in the first column, category b is in the second, and category c in the third. The code I am using doesn’t separate the categories into the correct columns, instead it repeats the custom posts for each column. Basically, it’s not recognizing the cat ids. Any suggestions?

    code is in pastebin

Viewing 2 replies - 1 through 2 (of 2 total)
  • First, you have set your category id ($cat_id) as the argument for your query instead of the arguments ($args).

    Second, you shouldn’t use categories since you have created custom taxonomies (I suppose). Get the IDs using functions for custom taxonomies.

    Ok. I got the taxonomy functions all figured out, thanks.

    Now, I have come across with the taxonomy files not loading. I have a CPT
    register_post_type( 'Programs', $args );

    and a custom taxonomy
    register_taxonomy( 'programs_category', array( 'programs' ), $args );

    I have created a few taxonomy.php files:
    taxonomy-programs_category.php
    taxonomy-programs.php
    taxonomy.php

    but none are not being recognized. However, when I use a custom template archive-programs.php all works as it should. Do I not need to use a taxonomy file?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to query custom post type categories in multiple loops’ is closed to new replies.