• hi guys!

    is it posible to call the categories and display them in multiple places of the post?

    when the query happend on the posts timeline you call the loop and include things
    like the title, tags, categories, date, author etc…
    well i want to show a specific category on the left side and the rest of them on the right.

    so the way im thinking (on my knowledge) it should be something like

    (left side) if category X exist display name, and the permalink to it.
    (right side) get the categories, exclude cat X

    any idea how to get something like this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • You’d want to write custom query and call the list of posts by category name or category id. See more here:

    http://codex.wordpress.org/Function_Reference/query_posts

    <?'query_posts( 'cat=5' );?>…followed by the loop and whatever you want to display.

    Then, to include all categories but one, just do:

    <?php'query_posts( 'cat=-5' );?>…again, followed by the loop and what you want to display.

    Note: If I’m not mistaken, you’ll need to add <?php rewind_posts();?> between queries to run multiple queries on one template file.

    Thread Starter sugartoys

    (@sugartoys)

    @ mfshearer72 thnx! 🙂

    but im sorry, it was to early when i wrote this and i think i didnt explain myself clearly because i was sleepy >_<

    i know what you mean but im not trying to query posts. im using the default query of wordpress, so im already query them.

    [ my english is not the best, so i will try to explain myself the best i can ^_^ ]

    for this i got the normal/default query blog post timeline style

    <?php while (have_posts()) : the_post(); ?>
    <li <?php post_class() ?> id="post-<?php the_ID(); ?>">
    <div id="date"><?php the_time('F j g:i a') ?></div>

    and so on with the title, tags, author etc. etc.

    but at some point im gonna call the category right, so i do it like this, simple

    <div class="category"><?php the_category(', ') ?></div>
    and lets say that post have 3 categories X, Y, Z so the query it will display it X, Y, Z

    fine, everything its cool, now the tricky part. well lets say i want to call it twice! but on a different place. lets say instead of

    <div class="category"><?php the_category(', ') ?></div>

    i want to call it like this

    <div class="category-2"><?php the_category(', ') ?></div>

    but this time i want just to show the name or permalink of the category X and exclude Y and Z. call the same categories again and exclude or include specific category, like X on this example.

    now, what im trying to achive. im doing a experiment on wordpress for a private site using wordpress as a log for ISP installations along using the wordpress app. but because the WP app doesnt let us yet use custom taxonomy im using categories and trying to filter everything with categories like provider, kind of equipment, IP. i want to show some categories in different areas to display it, lets say like custom meta tags does but instead categories, so i could filter or query them later when lets say im looking for all the installations of X provider or Z place.

    here a screenshot of a log on the timeline, have in mind this screenshot its the default query of posts i just put labels on the title and everything else to achine this idea.

    how im doing this
    im using the title for: the client
    geolocation for: the place

    <?php echo display_location("[geolocation]"); ?>

    category for kind of: service
    i was using tags for: providers (but on the WP app tags doesnt appear like the categories does with a list and checkmark, so i came with this idea of excluding categories)
    for the IP: im using the first 15 characters of the content
    Author for: the technician or employer

    is in spanish
    cl.ly/0t3U3h3U2R2B3v151S06

    thnx in advance to everyone =)

    Thread Starter sugartoys

    (@sugartoys)

    BTW i think the title of this post it could be misleading. if someone could change it to something like, exclude or include categories from <?php the_category(‘, ‘) ?> i think it make more sence 😛

    Thread Starter sugartoys

    (@sugartoys)

    i make some notes on this screenshot in case you didnt get what i mean.

    i need category X on the left and category Z on the right
    cl.ly/2t1T1p1w253m0x2G3z2l

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Divide and Display Categories in Multiple Places’ is closed to new replies.