Forums

Show Posts only from one Category (6 posts)

  1. phalancs
    Member
    Posted 2 years ago #

    Hello, i hope someonehas an idea on how to solve this:

    On my blog i have a menu with buttons named like the categories. So if someone clicks on themi want the according page to show only posts from that category.

    How to solve that? I tried some code, but all i ended up in was showing a few posts from that category but never managed to show a pagination or sth like that.

    Heeelp and thanx in advance :)

  2. vtxyzzy
    Member
    Posted 2 years ago #

    If your menu buttons show a page, you can use the Page Links To plugin as described in this thread.

  3. phalancs
    Member
    Posted 2 years ago #

    Thanx, this "kind of" works. But...

    It only redirects to the certain content, but then the menuitem is not set to "active" since the page does not contain anything itself.

    What i am looking for is something like a code snippet to create a loop just with the posts from a given category. I have that php execution thingy already installed.

    Any other ideas? Thanx :)

  4. vtxyzzy
    Member
    Posted 2 years ago #

    Let me be sure I understand. When you click on a menu item, it directs to a Page, not a Post, correct?

    Did you install the Page Links To plugin?
    Did you enter the link to the desired category in the spot for the URL?

    You will see the page content unless you linked the page to the category.

    Please post a link to the site so I can take a look.

  5. phalancs
    Member
    Posted 2 years ago #

    This is the Blog I am talking about http://bit.ly/czDRu2

    Check the "music", "videos" or "websites" tabs tabs in the menu. If you click on them they wont turn black like "images" for instance, cause they just redirect.

  6. vtxyzzy
    Member
    Posted 2 years ago #

    I'm sorry, I misunderstood the problem.

    In your code that you created to show the category, was it in a template? If so, you can add pagination to the query. It should look something like this:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') ? 1;
    $args = array(
       'paged' => $paged,
       'cat' => 44
    );
    query_posts($args);

    If I am off base here, can you post a snippet of the code you used?

Topic Closed

This topic has been closed to new replies.

About this Topic