WordPress.org

Ready to get started?Download WordPress

Forums

Filter Search Result by Categories ! (5 posts)

  1. donelpasso
    Member
    Posted 1 year ago #

    I searched for hours how to do that and found only old solutions for older vcersions :( I need to filter the search RESULT by categories. For example: I search for "mobile phone" and the posts with this search are in the categories "telecommunication". So i like to list this category and when i click on it then ONLY the posts with "mobile phones" must be displayed, not all posts in this category. Any ideas?

  2. This is some code from a recent project. Your welcome to use it but please note I will not be able to offer any support on its use.

    This was used in a sidebar on the search.php template. The search.php template just needs to contain your loop.

    $taxonomies[] = array(
    	'name'      => 'category',
    	'query_var' => 'category_name',
    	'heading'   => __( 'Filter by Category' ),
    ); ?>
    <?php foreach ( $taxonomies as $tax ): ?>
    	<?php $current_term = get_query_var( $tax['query_var'] ); ?>
    <aside class="search-filter">
    <header class="head">
    	<h3><?php echo esc_html( $tax['heading'] ); ?></h3>
    </header>
    <div class="content">
    <ul class="blogroll">
    	<li>
    	<?php if (! isset( $_GET[$tax['query_var']] ) ): ?>
    	<strong>All</strong>
    	<?php else : ?>
    	<a href="<?php echo esc_url( remove_query_arg( $tax['query_var'] ) ) ?>">All</a>
    	<?php endif; ?>
    	</li>
    	<?php foreach( get_terms( $tax['name'] ) as $term ): ?>
    	<?php $tax_shortcut = $tax['query_var'] ?>
    	<?php $term_shortcut = $term->slug ?>
    	<li>
    	<?php if ( $current_term == $term->slug ): ?>
    	<strong><?php echo esc_html( $term->name ) ?></strong>
    	<?php else : ?>
    	<a href="<?php echo esc_url( add_query_arg( $tax_shortcut, $term_shortcut ) ) ?>"><?php echo esc_html( $term->name ) ?></a>
    	<?php endif; ?>
    	</li>
    	<?php endforeach; ?>
    </ul>
    </div>
    </aside>
    <?php endforeach ?>
  3. donelpasso
    Member
    Posted 1 year ago #

    thanks i tryed it but its not exactly what im looging for. first of all, it don't really pick the search result from specific categories, i can see it in the url it just ad the category name to the search. i would pay 100$ for the solution of my problem i spended at least 30 hours to solve it till now

  4. Andrew Nevins
    Barrel Rider, Spam Zapper & Volunteer Moderator
    Posted 1 year ago #

    Try the jobs section at WordPress
    http://jobs.wordpress.net/

  5. donelpasso
    Member
    Posted 1 year ago #

    i tryed it there but my request doesn't appear. where else can i search for programmer for wordpress?

Topic Closed

This topic has been closed to new replies.

About this Topic