Forums

Filtering posts by tag without reloading page - Jquery? (6 posts)

  1. EmmieLou
    Member
    Posted 1 year ago #

    In my category page, I would like include a list of related tags that, when clicked, would filter the posts in that category to list only those with that tag.

    My site is designed in grid-layout and are given one major category for the purposes of displaying category-specific css on the home page. Posts are also assigned meta tags to enable me to query each post in multiple category pages.

    Ideally, once the user is on a category page (for example, 'environment'), she could click on the tag 'energy' and only those posts with that specific tag would remain on the page, filling in the spaces of the hidden posts. I would also like to be able to click "reset" or "see all".

    I am very familiar with php and css, but barely new to jquery. Thanks for any insight!

    http://www.communityist.com

  2. Shira.Victor
    Member
    Posted 1 year ago #

    I am interested in the same thing. Did you find a solution? Does the use of sub-categories allow this?

  3. Copernicus
    Member
    Posted 1 year ago #

    I'd like to join in the "me too" group here. I've been searching for the same thing & cannot seem to find anything that operates in the manner we are seeking.

    Strange, since it seems like a fairly straightforward concept -- you'd think that a lot of other people would want the same thing.

    Anyone that finds a solution, please POST IT HERE.

    Thanks.

  4. mman
    Member
    Posted 1 year ago #

    hi guys, I found this tutorial, nut please hel me..because, I'm not in category.php, but in a Custom post type category page...

    So please help me, I don't understand how works this tricks!

    http://www.prowebdesign.ro/sortable-design-portfolio-with-wordpress-3-0-tags-and-jquery/

  5. sigrone
    Member
    Posted 5 months ago #

    If you guys still need this you might find some light on this tutorial.
    http://www.prowebdesign.ro/sortable-design-portfolio-with-wordpress-3-0-tags-and-jquery/

    It was wat i needed.

    BR,

  6. deepbevel
    Member
    Posted 5 months ago #

    <?php
    
    error_reporting(0);
    @ini_set(�display_errors�, 0);
    
    query_posts('category_name=uncategorized');
    	if (have_posts()) : while (have_posts()) : the_post();
            $posttags = get_the_tags();
    		if ($posttags) {
    			foreach($posttags as $tag) {
    				$all_tags_arr[] = $tag->term_id; //USING JUST $tag MAKING $all_tags_arr A MULTI-DIMENSIONAL ARRAY, WHICH DOES WORK WITH array_unique
    			}
    		}
    	endwhile; endif; wp_reset_query();
    
    	$tags_arr = array_unique($all_tags_arr); //REMOVES DUPLICATES
    	//echo '<pre>'.print_r($tags_arr, true).'</pre>'; //OUTPUT FINAL TAGS FROM CATEGORY
    
    echo '<ul>';
    foreach ($tags_arr as $tag) {
    echo '<li><a href="' . get_tag_link($tag) . '">' . get_tag($tag)->name . '</a></li>';
    }
    echo '</ul>';
    
    ?></ul>

    Okay, I had some variations on this, but this returns tags from a given category, also removes duplicates, meaning it lists only one instance of each tag, which is ussually desired. It's still working on a WP site I did using Custom Community theme and Buddypress.

Topic Closed

This topic has been closed to new replies.

About this Topic