I want to show posts, that are in a similar category as the page. Here is my code (just the important php part, not html)? What is wrong?
<?php $pages = get_pages(array('child_of' => 13)); ?>
<?php foreach ($pages as $page): ?>
<?php echo $page->post_title; ?>
<?php echo $page->post_excerpt; ?>
<?php echo $page->post_content; ?>
<?php $categories = get_the_category($page->ID);?>
<?php query_posts('post_type=projekt&category_name=$categories&showposts=1');?>
<?php while (have_posts()) : the_post(); ?>
<?php the_title(); ?></a>
<?php endforeach; ?>
Thanx!
try
without testing, this line looks incorrect:
the
$categories
variable is being interpreted literally because of the single quotes