Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other wordpress 1 million $ question Reply To: wordpress 1 million $ question

#156705
Eduard
Participant

something like this:

<ul class="products">
            <?php foreach ( $categories as $category ) { ?>
            <?php 
            $querystr = "SELECT $wpdb->posts.*
                            FROM $wpdb->posts, $wpdb->term_relationships, $wpdb->terms
                            WHERE term_id = (" . $category->cat_ID . ")
                            AND term_taxonomy_id = (" . $category->term_taxonomy_id . ")
                            AND ID = object_id
                            AND post_type = 'Product_Image'
                            AND post_status = 'publish'
                            ORDER BY post_date ASC";
            $posts = $wpdb->get_results($querystr, OBJECT);
            $categories2 = get_terms('brands',array('parent' => $category->term_id , 'hide_empty'=> '0', 'orderby' => 'name', 'order' => 'DESC', ));
            ?>

              <?php foreach ( $categories2 as $category ) { ?>
                <?php $posts = get_posts( array( 'brands' => $category->slug, 'post_type' => 'Product_Image', 'showposts' => -1 ) );  ?>
                <?php foreach($posts as $post) { ?>

                  <li data-product="<?php echo $category->name; ?>" class="inactive"><?php the_title(); ?></li>

                <?php } ?>

              <?php } ?>
            <?php } ?>

            </ul>