Forums

How to make a loop filtering on taxonomy and column (1 post)

  1. haaaas
    Member
    Posted 7 months ago #

    Hi everyone, i am having troubles creating a loop for a custom post type showing only a specific taxonomy with a specific column.

    I explain:
    I created a custom post type called: product
    having two taxonomies: product_category and product_tag
    and I added a custom column called: _product_type with 3 different values: CD MP3 and PDF.

    On my front page template I created a list of links to all categories using:

    <?php $args = array('taxonomy' => 'product_category'); ?>
    <?php $tax_menu_items = get_categories( $args );
        foreach ( $tax_menu_items as $tax_menu_item ):?>
            <a href="<?php echo get_term_link($tax_menu_item,$tax_menu_item->taxonomy); ?>">
    	<?php echo $tax_menu_item->name; ?></a>

    These links bring me to the template taxonomy-product.php with the standard wordpress-loop giving me a list with all products within a specific product_category. (all working fine till now)

    Now I want to change this template/loop to give me first all the products of the _product_type (column): CD, than MP3 and than PDF.

    I tried using a Custom Select Query before the loop selecting only one _product_type (eg MP3) but in this way I loose the filtering of category and gives me all products with the _product_type:MP3 (no matter which category)

    Is there a way to change the loop giving me only specific columns and specific taxonomy?

    Hope i explained my problem well, thanks for your help

Reply

You must log in to post.

About this Topic