Forums

[resolved] Tag and Category in one URL (Groupon country select form) (12 posts)

  1. m.mujgos
    Member
    Posted 4 months ago #

    I was looking for this days. Cant find how to do it in WP.

    I want - in short - the funcionality of COUNTRY SELECT FORM on groupon.com.

    Which mean, when i set once a type of posts what I want to show, then it will show only POSTS. And the parametr WILL STAY until i will change it again.

    My idea was to solve it like posts will have classic categories, and tags will be COUNTRIES. When I set country(tag), and I will browse categories, it will show just posts with category&tag match. Problem is, that tag dont stay "checked" and I also cant mix it in URL(which would solve it).

    Any idea, or better solution how to make this?

    Thanks

  2. deepbevel
    Member
    Posted 4 months ago #

    I'm not sure but it sounds like you want to display posts which have a common tag, and are in one category? Is it for a search or to display on a page or as a list?

  3. m.mujgos
    Member
    Posted 4 months ago #

    Could be this way.. But I am not sure if I can do this:

    1. I will choose country
    http://www.url.com/tag1/
    2. I will click on category
    http://www.url.com/tag1/category1
    3. I will click on other category (see? tag dont change)
    http://www.url.com/tag1/category2

    And also I dont know if there is way to filter by category and tag at the same time.

    __________________________________________

    Maybe better explanation is to imagine it like a multilanguage site. You click another language
    http://www.url.com/en/category1
    Categories are still same, but showing something different. Language dont change until you do it again.
    http://www.url.com/fr/category1

  4. deepbevel
    Member
    Posted 4 months ago #

    code which filters category and tag:
    code

  5. m.mujgos
    Member
    Posted 3 months ago #

    Thanks that will help. But additional a find out that solution what i was looking for was using sessions. (with filtering tags u send me.

    if (isset($_GET['variable'])) {
    $some_variable= $_GET['variable'];
    $_SESSION['variable'] = $some_variable;
    }

    with use of form, sending GET.

  6. deepbevel
    Member
    Posted 3 months ago #

    I don't think I follow, but I'm glad if it helped.

  7. batpunk
    Member
    Posted 18 hours ago #

    I have been searching for a solution to this for days, I want to achieve this on my website. But I haven't quite followed. Where does this code go?

    Please help! Thank you.

  8. deepbevel
    Member
    Posted 13 hours ago #

    I'm not sure I was ever 100% on the goal. Do you just want to filter by both category and tag?

  9. batpunk
    Member
    Posted 7 hours ago #

    Yeah - I need countries and then types (like deals, offers)...

  10. deepbevel
    Member
    Posted 5 hours ago #

    the code I posted gets all tags in a selected category, without duplicates. It would have to be modded to grab a specific tag or tags. I wouldn't expect it to be too difficult but my php has gone from bad to worse, out of practice. I'll post if I have a chance to play with it.

  11. deepbevel
    Member
    Posted 4 hours ago #

    looks like I may have another excuse to slack on coding.
    check this out

  12. deepbevel
    Member
    Posted 4 hours ago #

    codewise, what you need should be much simpler than what my previous code does:

    <?php query_posts( 'category=10&tag=deals' );
    while ( have_posts() ) : the_post();
    	echo '<li>';
    	the_title();
    	echo '</li>';
    endwhile;
    wp_reset_query();
    ?>

    Of course you can change the_title to the_excerpt or the_content.

Reply

You must log in to post.

About this Topic