Loop/Category/Code/Template assistance please.
-
Hi,
I’ve had some help creating our own wordpress theme for http://guymorgan.com. and the pages that I want to tweak are for the gallery pages (category pages, really) – the coder has set it up so that I need to duplicate the template for each category to display the gallery pages (like this one (http://guymorgan.com/landscape/).
Here is the code he’s used in the template
<?php query_posts( 'category_name=landscape' ); if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="galbox"> <a href="<?php the_permalink() ?>"><img src="<?php $img = get_post_meta($post->ID, 'img', true); echo $img; ?>"></a><p><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></p> </div>Each post has a Custom Field called ‘img’ and so the template is dynamically pulling in those fields, and this is awesome. But what I want is to only have 1 template that is dynamically pulling in the categories in the section of code below – so that Guy doesn’t have to recreate the template with each new gallery…
<?php query_posts( 'category_name=landscape' ); if (have_posts()) : while (have_posts()) : the_post(); ?>Is there anyone out there who would be able to tell me how to write that code? so that the category is dynamically inserted in the code above??? I’m sure there’s loop type php stuff (see, total code gumby!) – and I figure you guys are cleverer at this stuff than me! Can you advise what I should do?!
Thanks heaps
Dee
The topic ‘Loop/Category/Code/Template assistance please.’ is closed to new replies.