That should be possible if you’re inside the main Loop when you run the second query. Something like:
<?php
$args= array(
'category_name' => $post->post_name,
'post_type' => 'product'
);
query_posts($args);
?>
When I put the query inside the main loop the content won’t show at all. This is what I did, and it still won’t work:
<?php
if ( have_posts() ) {
while ( have_posts() ) {
// The Query
$args= array(
'category_name' => $post->post_name,
'post_type' => 'product'
);
query_posts($args);
} // end while
} // end if
What is it that you are trying to do?.
try using get_the_title()
You are better off using $post->post_name (the post slug) instead of the actual title. The slug will always make a valid category term, the actual title could contain invalid characters for category terms.
Like esmi, I’m not sure where you’re going with this, but to see anything from a call to query_posts() you need to run a second loop that outputs what you want to see. After running the loop, you must also call wp_reset_query() to restore the main query.
Ideally, you should be using WP_Query() for a secondary loop – not query_posts().
I realised that I went better of using the category system in wordpress. In this way the specific category page automaticly gets the name of the category which it is. I thank you all for the help anyway!