Sorting content from the Main loop
I’m working on a website in wich I use custom post ans custom taxonomy.
I use a Custom Post called “artstore” (a kind of product). Each one of these products has a taxonomy attached, called “artiste’ (functions as a tag) and some categorie.
Basically, I have to show some artistic products organised by artist’s name.
I have some problems with one particular page. This page must :
– show products from artstore CP, in a particular category (id 169)
– show only one (the first I guess) product by artist
– every product must link to a page whereare shown all product in cat169 for the artist
I have this code :
<div id="ma_liste"> <?php wp_reset_postdata(); ?> <?php query_posts('posts_per_page=-1&post_type=artstore&cat=169&order=ASC'); ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="artstore-article" > <span class="vignette"><a>"><?php echo get_the_post_thumbnail(); ?></a></span> <h4><?php $term_list = wp_get_post_terms($post->ID, 'artiste',array("fields" => "names")); print_r($term_list); ?> // <?php the_title(); ?></h4> <?php if (class_exists('MultiPostThumbnails')) : MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'featured-image-3', NULL, 'portfolio-thumb'); endif; ?> </div>
[Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]
Of course, this page show all the products in the category 169.
I got to :
1- show only one product by artist
2- link to a page where all the products of an artist in the cat169 are shown.
Do you have any idea of the methods to do this.
About point 2, I’m thinking of creating a template page ‘liste-produit-artiste.php’ wich could be called with the name of the artist as parameter (kind of –> liste-produit-artiste.php&artiste=’toto’ )
What do you think about this ? I could use the search page, but I need a different design (and sidebar))
I(m searching in Codex, but since I’m a noob in PHP, any help will be appreciated.
thanks in advance and sorry for the bad english.
- The topic ‘Sorting content from the Main loop’ is closed to new replies.