I have a catalog style website running with Magic Fields. Its for furniture in "collections" but organized by category of type (bed, stool, dresser, etc) we would like to create a way to display items with the same "collection" some how.
This is my first time using this service so please bear with me.
Oleg Butuzov answers:
<?php
/**
*** Related Products by tags
**/
//get_objects_in_term()
$terms =get_the_terms( $post->ID, 'post_tag' );
if (is_array($terms) && count($terms) > 0){
foreach($terms as $k=>$i){
$terms[$k] = $i->term_id;
}
$ids = array_unique(get_objects_in_term($terms, 'post_tag'));
if (is_array($ids) && count($ids) > 0){
foreach($ids as $k=>$i){
if ($i == $post->ID){
unset($ids[$k]);
}
}
shuffle($ids);
}
}
?>
+
<?php
$params = array(
'showposts' => 9,
'posts_per_page'=> 9,
'post__in' => $ids);
?>
<?php query_posts($params); ?>
+
[[LINK href="http://www.smashingmagazine.com/2009/06/10/10-useful-wordpress-loop-hacks/"]]exampples of query_posts[[/LINK]]
On your request. BEAR!
Rashad Aliyev answers:
If you need more you can use: Custom Field Template plugin. http://wordpress.org/extend/plugins/custom-field-template/
That's wonderful to make your own custom templates.
Matt Heyes answers:
Since WP 2.8 you can use Custom Taxonomies to make more ways to organise your posts. Instead of being limited to just Category and Tags, you can now create your own custom taxonomy called Collection. You can even have a permalink called collection which returns related content for example yourdomain.com/collection/vintage
I think you will find all the answers you need to create this in the following post:
http://justintadlock.com/archives/2009/05/06/custom-taxonomies-in-wordpress-28