Displaying Category and Post Name trouble
-
Hi,
I currently have an issue which seemed pretty straight forward, but then realising I cant use a portion of PHP within PHP seemed to knock things back a little.
Im trying to edit the single.php file, to display posts from a sub-category that relevant to that particular post.
The current code is:
<?php query_posts('category_name=photos<?php the_title(); ?>&showposts=-1'); ?> <?php while (have_posts()) : the_post(); ?> <a href="<?php the_permalink() ?>"> <?php if ( has_post_thumbnail() ) { the_post_thumbnail( ); } ?> </a> <?php endwhile;?>
The plan being that there would be a sub-category with the same name as the post title.
I know I could just put in the name of the sub-category directly into the query, however this has to be dynamic, so that when a new Post is added, it will display everything in the sub-category with the same name as it.
I hope that makes sense, so any help is appreciated on doing this.
Thanks,
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Displaying Category and Post Name trouble’ is closed to new replies.