Syntax for multiple variables in query_posts( ‘posts_per_page=-1’)
-
Hi there,
I’m currently working on a wordpress theme based on iTunes that uses a list view for archives such as categories, tags and search results. In order to override the “Blog pages show at most” value for the archives I use the following handy code at the start of my archive.php which I found here:
<?php get_header(); query_posts( 'posts_per_page=-1&cat=' . $cat ) ?>
Unfortunately however, this only works for categories, with tags links etc displaying every possible post as if the code were:
<?php get_header(); query_posts( 'posts_per_page=-1' ) ?>
To get around this, I’ve created duplicates of the archive page for tag.php, search.php and so on, customising the code for each page, so for example tag.php begins:
<?php get_header(); query_posts( 'posts_per_page=-1&tag=' . $tag ) ?>
While this works, it’s not the best solution as I have a lot of duplicate content should I wish to modify the archive layout.
Can someone give me help please as to what the syntax would be to have only one line of code that would modify the posts_per_page value for $cat, $tag, $s, $year etc, which I can place in my archive.php only?
I’ve tried variations like that below but to no avail:
<?php get_header(); query_posts( 'posts_per_page=-1&cat&tag=' . $cat . $tag ) ?>
Thanks in advance for any help,
Jonathan
- The topic ‘Syntax for multiple variables in query_posts( ‘posts_per_page=-1’)’ is closed to new replies.