Support » Fixing WordPress » Get posts from single category on Page with posts

  • Resolved travelsonsaddles

    (@travelsonsaddles)


    Hi,

    I am totally new to WP and hope that someone out there can help me out.
    I assume that my query isn’t too complicated yet I don’t seem to be able to find a working solution.

    I plan to run two languages on my blog. Main language will be English but I want to have a page on which I can include posts in Polish only.

    I’ve managed to successfully exclude Polish posts from my home page by adding

    <?php if ( is_home() ) {
    query_posts($query_string . '&cat=-3');
    }

    to my index.php (I’m using weavern theme)

    I’ve tried this

    <?php if ( is_page('zapiski-moniki') ) {
    query_posts($query_string . '&cat=3');
    }

    both in index.php and loop.php but this doesn’t seem to do the trick and all posts show on that page, not just the ones in Cat 3 (being in Polish)

    Is it the wrong code or do i put it in wrong place, or maybe I defined my page incorrectly?

    I’d very much appreciate any help.
    Thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • esmi

    (@esmi)

    Forum Moderator

    Try adding the second code block to the default Page template file – page.php.

    Thank you esmi for your reply. I’ve tried that and still no luck. Is there a specific place within page.php file where I should insert it? I put it in as a first thing in a file.
    Thanks

    esmi

    (@esmi)

    Forum Moderator

    It needs to go just before the main Loop.

    I must be doing something wrong. I’ve tried that too and still all posts show up on that page. Is there a better way of doing it, some ifelse maybe? Did I categorise my page (by slug) correctly?
    As I said I’m very new to this and I’m struggling to get my head around php, so any detailed help would be much appreciated in how to get this issue sorted. Thanks.

    esmi

    (@esmi)

    Forum Moderator

    Drop a copy of the file into the WordPress pastebin and post the pastebin url here. Perhaps someone will be able to spot the problem and suggest a solution.

    Thanks esmi for trying to help.
    Copies of both page.php and index.php (where the bit excluding cat 3 works) are now here:
    http://pastebin.com/nUSgtvUN

    Thanks again

    esmi

    (@esmi)

    Forum Moderator

    Try asking about this on the theme’s dedicated forum: http://wpweaver.info/forum/

    Thanks again esmi. I’ve managed to solve it myself. It turned out that there was a function for it in the theme I just wasn’t seeing it.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Get posts from single category on Page with posts’ is closed to new replies.