• Hi
    What I want to do is to first pull all posts from category(2) and show one of the on the front page. I do that now by using
    query_posts('cat=2&posts_per_page=1');

    Then on another part of the page, I want to pull all posts including category(2) but offset that category by 1 and show two posts. I know its not possible but something like this:
    query_posts('posts_per_page=2&offsetcat2=1');

    Is there a straight forward way to do that, or how would I go about doing it?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter kasperbs

    (@kasperbs)

    Anyone?

    Thread Starter kasperbs

    (@kasperbs)

    Right, I have tried to come up with something, I don’t know if I’m going in the right direction, so any feedback would be nice. I didn’t know anything about mysql queries so I had to do a little research before trying this. But I have managed to get an array of the ID of the posts in the specific category by using this:

    SELECT * FROM ks_term_relationships WHERE term_taxonomy_id = 42 ORDER BY ks_term_relationships . object_id DESC

    I have tried to echo the results outby doing something like this:

    $result = mysql_query($sql) or die(mysql_error());
    while($row = mysql_fetch_array($result)){
     echo $row['object_id'];
     echo "";
    }

    This echoes all the ID’s from the posts but then I need a way to exclude the first post and include all other posts from my site, for in the end echoing out the Titles and links to them as described in my first post.

    Thread Starter kasperbs

    (@kasperbs)

    If anyone can say anything about which direction I should be going it would be much appreciated. Should I mess around with the MySQL queries or is there an easier method?

    Thread Starter kasperbs

    (@kasperbs)

    OK I found this thread by accident searching on Google. It’s very close to what I want to do. I’m trying to figure out how to adapt the code but I’m pretty lost, so if anyone can jump in with ideas it would be much appreciated.

    this is the thread:
    https://www.ads-software.com/support/topic/142712?replies=22

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Pull All Posts But Offset a Specific Category by 1’ is closed to new replies.