• Resolved mouche

    (@mouche)


    Hello everyone, i’m new in the forum.
    I’m a beginner, so my programming skills are not so good (but still-evolving!), and i am working on a blog site.
    I need help about: how can i show in a blog-page only one category posts?
    For example: i define “page-a” “page-b” “page-c” pages, and “cat-a” “cat-b” “cat-c” categories, and in “page-c” i wanna show only “cat-a” posts.
    It is different if some pages have a template different from the blog-home?
    Thanxx.

Viewing 13 replies - 1 through 13 (of 13 total)
  • when you create or edit a post you assign it to a category
    (little box to right of edit screen)

    Thread Starter mouche

    (@mouche)

    hello samboll, i know that i can assign any categories to a post.
    i want know how can i tell the loop to filter posts, and show only one-kind-category-posts..

    You don’t need that. WP does that out of the box. Click on a category name and only posts from that category will be displayed.
    BTW, don’t use Pages for displaying posts. Pages are not for that.

    Thread Starter mouche

    (@mouche)

    hi moshu, i know, but i wanna build a site that is between blog and cms, and i think that kind of site is easier to navigate if main menu displays pages and not categories..
    aternatively, i could use categories directly on main menu, but i should modify those lines:

    <div id=”header”>
    <div class=”hmenu”>

    <? unset($pages); ?>
    </div><!– end hmenu –>
    </div><!– end header –>

    but i should modify those lines:

    Yes, that’s exactly what you should do. It is easier to modify a menu than to force WP to do abnormal things.

    Thread Starter mouche

    (@mouche)

    ok, now i try

    Thread Starter mouche

    (@mouche)

    tonite i will read your article.. and then i’ll tell you about.. in the mean time, thank you!

    Heck, this is way more useful:
    https://moshublog.com/2007/09/10/static-frontpage-combined-with-dynamic-content/
    As a matter of fact, I think this is pretty close to what is being asked for here, just needs a little configurability (and paging support):
    In the main loop:

    <?php $page_title = the_title('', '', FALSE); ?>

    Then fetch the posts:

    <?php
    	$par = 'category_name=' . $page_title;
    	if( isset( $wp_query->query_vars['paged'] ))
    		$par = $par . '&paged=' . $wp_query->query_vars['paged'];
    	query_posts($par);
    ?>

    And then display them as you want. I just copied the loop code from index.php.
    The technique is definitely not limited to front page…

    Thread Starter mouche

    (@mouche)

    moshu, that article in your blog is great.. and i thank you to redifine my wordpress-head-process of building a site.

    in the article, you said that i should rename a page file name with name of category (for example a page named info.php in category-3.php) so i can call that page by clicking on category-list with ID #3.
    i have some questions for you:

    • why category #3 doesn’t appear in header-category-list (i haven’t used exlude option)
    • how can i assign caategory #3 to an article
    • how can i define ID category to a category already existing

    P.S. thanks to triibutu for the post, soon i’ll try your alternative way and i’ll tell you about.

    Here’s an example page template that displays posts from the same category as page title under page content (based on WP2.6.3 default theme): https://www.hot.ee/triibutu/page-category-posts.zip

    Thread Starter mouche

    (@mouche)

    triibutu, in the meanwhile i was waiting for moshu’s answer, i tried the way you was suggesting, and it works great!!
    thank you, i think i have resolved my problems!!

    Hi Triibutu, Im trying your way to show some posts of different chategories in de equal named page-template. But I still cant get it working correctly..

    my situation now:

    I a website separated in 2 parts(school with 2 locations).Each location have their own subpages(news, parents, newsletter, classes, ..etc).Now I want in the posts from category ‘location1’ in home>location1>groups. Posts from category ‘location1’ in home>location2>groups.the categories location1 and location2 also have subcategories like class1, class2 etc.

    Can you help me out? tnx in advance

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Different pages, different categories’ is closed to new replies.