Mununkulus
Member
Posted 1 year ago #
hi there,
i got a slight problem i can't seem to resolve myself.
i use arthemia theme, which has a seperate space for a headline and further down for all posts from any category.
what i wanna do, is make it not show the first (latest) post of the category headline (in my case the cat id is 4), but only show them from post 2 onwards to avoid double entries.
can any1 help me on how the code for that works ?
Mununkulus
Member
Posted 1 year ago #
how exaclty would i implement that into the following code?
`<?php
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("cat=-3,-4&paged=$page&posts_per_page=5"); ?>`
at the moment i discarded the headline and another category completely (-3,-4). How would i have to change this if i wanted to still discard category 3 and show the 4th category with an offset of 1 ?
from what i understand from your link, it would use the offset for every single category, while i only want it for a specific one (the 4th category).
<?php
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("cat=-3,-4&paged=$page&posts_per_page=5&offset=1"); ?>
that should do it if we just used the code you have but if you simply want to do it with category with id of 4 then you'd need conditional statements.
<?php
if(is_category(4)){
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("&cat=-3paged=$page&posts_per_page=5&offset=1");
}
?>
So we're putting a conditional in to make the top bit of code only run if it's category 4. A better way to do it would be to use the category name instead of the number since the number will change if you move the site to a new database while the name will most likely stay the same.
I'd recommend reading the following to get yourself up to speed on the topics.
http://codex.wordpress.org/Conditional_Tags
http://www.themelab.com/2008/04/14/the-ultimate-guide-to-wordpress-conditional-tags/
<?php
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("cat=-3,4&paged=$page&posts_per_page=5&offset=1"); ?>
Try this.