WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Get posts from single category on Page with posts (9 posts)

  1. travelsonsaddles
    Member
    Posted 2 years ago #

    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!

  2. esmi
    Forum Moderator
    Posted 2 years ago #

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

  3. travelsonsaddles
    Member
    Posted 2 years ago #

    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

  4. esmi
    Forum Moderator
    Posted 2 years ago #

    It needs to go just before the main Loop.

  5. travelsonsaddles
    Member
    Posted 2 years ago #

    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.

  6. esmi
    Forum Moderator
    Posted 2 years ago #

    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.

  7. travelsonsaddles
    Member
    Posted 2 years ago #

    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

  8. esmi
    Forum Moderator
    Posted 2 years ago #

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

  9. travelsonsaddles
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic