• I have two categories 1 accountants 2. city(New York) so a user visits my site sees accountants category clicks on it and wordpress displays all accountants. Now I would like to just filter out accountants in New York, or show all accountants in New York. Is there a way that I can achieve this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter bisresearch

    (@bisresearch)

    Is there a way to query_post within a category? Show all post in a category then query those posts?

    try this:

    <?php
    $posts = get_posts('numberposts=6&category=2');
    foreach($posts as $post) :
    ?>
    <div class="Box"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a><small><?php the_time('F jS, Y') ?></small></div>
    <?php endforeach; ?>

    change nr post 6 and category=2 to your wish, the code show 6posts in cat2

    cheers

    Hi, I would like to know how it will be possible to display archives list sorted by Category and filtered by Another Category and post listed by date within this part. I would like to display this in one category/archive page like this’
    ‘Food’ (categroy A)

    ‘After 4 month’ (Category B)
    date : Post Tittle(+permalink)
    date : Post Tittle(+permalink)

    ‘After 5 month’ (Category C)
    date : Post Tittle(+permalink)
    date : Post Tittle(+permalink)

    ‘After 6 month’ (Category D)
    date : Post Tittle(+permalink)
    date : Post Tittle(+permalink)

    etc
    Note ‘After 4 month’ is a category not a date.
    Thanks in advance for your previous help.
    S

    I’m working on this king of stuf but I’m not a coder :`<?php
    $posts = get_posts(‘numberposts=6&category=12’);
    foreach($posts as $post) :
    ?>
    <div class=”Box”>” title=”<?php the_title(); ?>”><?php the_title(); ?><small><?php the_time(‘ j F Y’) ?></small></div>
    <?php endforeach; `?> thanks for your help guys. s

    My solution : hope this helps,
    br
    s
    <?php $temp_query = $wp_query; ?>
    <?php query_posts(‘cat=1,15’); ?>
    <?php while(have_posts()) : the_post(); ?>
    <!– <?php the_title(); ?> –>
    <div class=”Box”>” title=”<?php the_title(); ?>”><?php the_title(); ?><small><?php the_time(‘ j F Y’) ?></small></div>

    <?php endwhile; ?>
    <?php $wp_query = $temp_query; ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Category Filter’ is closed to new replies.