Multikriteriální filtrování (vyhledávání) příspěvků

**Multiple Category Selection Widget**
„http://wordpress.org/extend/plugins/multiple-category-selection-widget/“:http://wordpress.org/extend/plugins/multiple-category-selection-widget/

This plugin gives you the ability to provide your users with a widget full of dropdowns based upon parent categories and their sub-categories.
You can now set up an AJAX chained select box. For example, if you have multiple countries, and multiple states for each country, you can get a user to select a country. Upon selecting the country, the plugin looks for any states under that country, and then shows the dropdown box for the states under that country beneath the country dropdown.

Multiple subcategories spanning multiple parent categories (though multiple categories inside a single parent cannot be chosen) are chosen and intelligently filter your posts.

Please note that this plugin, while it is a widget, can be used on a sidebar you define anywhere within your theme that you like. Think of it as a ‚block‘ area rather than a ‚sidebar‘.

*Alternativy*

**WP Ultimate Search**
„https://wordpress.org/plugins/wp-ultimate-search/screenshots/“:https://wordpress.org/plugins/wp-ultimate-search/screenshots/

Powerful AJAX-based search alternative which supports faceting queries by taxonomies, terms, location, and post metadata.

**Query Multiple Taxonomies**
„http://wordpress.org/extend/plugins/query-multiple-taxonomies/“:http://wordpress.org/extend/plugins/query-multiple-taxonomies/

Say you have two custom taxnomies defined: *genre* and *artist*.

Currently, you can do the following types of queries on your site:
?genre=jazz
?genre=jazz&cat=1

But you can’t do this:
?genre=jazz&artist=chet-baker

WordPress will just ignore one of the parameters. This plugin fixes that. It also comes with a drill-down navigation widget.

[* http://s.wordpress.org/extend/plugins/query-multiple-taxonomies/screenshot-1.png?r=358842 *]

**WP Custom Fields Search**
„http://wordpress.org/extend/plugins/wp-custom-fields-search/“:http://wordpress.org/extend/plugins/wp-custom-fields-search/

This plugin allows multiple form inputs to be configured to search different aspects of a post including custom fields.
It is designed to filter posts in a more structured way than the default wordpress search. Specifically it allows multiple form inputs to be configured to search different aspects of a post, i.e. one term could search the post content, one the post title and one could search a custom field associated with the post.

The blog admin is able to build a customised search form. It allows you to search by the standard post information and by custom fields and to choose what HTML form elements should be presented for each search field.

**Taxonomy Picker**
„http://wordpress.org/extend/plugins/taxonomy-picker/“:http://wordpress.org/extend/plugins/taxonomy-picker/

Taxonomy Picker is a widget which you can include in your sidebar to help visitors build complex queries using categories and your custom taxonomies by chosing terms from drop down boxes. The widget also includes a text search making it easy to search for text only within certain categories or taxonomies.
Results will be displayed using your theme’s standard search form so the results need no additonal styling.

„Demo »“:http://www.egyptological.com/find

**Úpravou kódu (bez pluginů)**

Výběr (průnik) z více štítků současně, zaškrtáváním checkboxů v šabloně stránky s filtrem:

/—code php

term_id.'“>‘.$tag->name.‘‚;
endforeach;
print $checkboxes;
?>

$value) {
// tag1 AND tag2 is chosen, add a plus after the tags.
$string .= $value.’+‘;
}
// Remove the last + symbol in the string
$tags = substr($string, 0, -1);
}

// build the url with the variables
$url = home_url().“?tag=$tags“;

// redirect to output page
wp_redirect($url); exit;
endif; ?>
\—

Výběr (průnik) z více kategorií současně, zaškrtáváním checkboxů:

U kategorií je třeba ještě nejprve přidat do *functions.php*
/—code php
// List categories with checkboxes
function get_categories_checkboxes( $selected_cats = null ) {
$all_categories = get_categories();
$o = ‚

    ‚;
    foreach($all_categories as $key => $cat) {
    if($cat->parent == „0“) $o .= __show_category($cat, $selected_cats);
    }
    return $o.‘

‚;
}

function __show_category($cat_object, $selected_cats = null) {
$checked = „“;
if(!is_null($selected_cats) && is_array($selected_cats)) {
$checked = (in_array($cat_object->cat_ID, $selected_cats)) ? ‚checked=“checked“‚ : „“;
}
$ou = ‚

  • ‚;
    return $ou;
    }

    // get category slug form id
    function get_cat_slug($cat_id) {
    $cat_id = (int) $cat_id;
    $category = &get_category($cat_id);
    return $category->slug;
    }
    \—

    a v šabloně stránky s filtrem pak

    /—code php

    $value) {
    // cat1 AND cat2 is chosen, add a plus after the cats.
    $slug = get_cat_slug($value);
    $string .= $slug.’+‘;
    }
    // Remove the last + symbol in the string
    $cats = substr($string, 0, -1);
    }

    // build the url with the variables
    $url = home_url().“/rubriky/“.$cats.“/“;

    // redirect to output page
    wp_redirect($url); exit;
    endif; ?>
    \—

    This shows 15 posts (total) from categories 3 and 11 and 9

    /—code php



    \—

    „List categories with checkboxes »“:http://translate.google.com/translate?hl=en&sl=it&tl=en&u=http%3A%2F%2Fwww.undolog.com%2Fcategory%2Fwordpress%2Fpage%2F2%2F

    „Filtering WordPress categories using undocumented hook »“:http://soulsizzle.com/wordpress/filtering-wordpress-categories-using-an-undocumented-hook/

    Roletka s tagy v sidebaru

    Do sidebaru lze doplnit roletku s existujícími tagy přidáním funkcí do *Funkcí aktuálního vzhledu*,

    /—code php
    8, ‚largest‘ => 22, ‚unit‘ => ‚pt‘, ‚number‘ => 45,
    ‚format‘ => ‚flat‘, ‚orderby‘ => ‚name‘, ‚order‘ => ‚ASC‘,
    ‚exclude‘ => “, ‚include‘ => “
    );
    $args = wp_parse_args( $args, $defaults );

    $tags = get_tags( array_merge($args, array(‚orderby‘ => ‚count‘, ‚order‘ => ‚DESC‘)) ); // Always query top tags

    if ( empty($tags) )
    return;

    $return = dropdown_generate_tag_cloud( $tags, $args ); // Here’s where those top tags get sorted according to $args
    if ( is_wp_error( $return ) )
    return false;
    else
    echo apply_filters( ‚dropdown_tag_cloud‘, $return, $args );
    }

    function dropdown_generate_tag_cloud( $tags, $args = “ ) {
    global $wp_rewrite;
    $defaults = array(
    ‚smallest‘ => 8, ‚largest‘ => 22, ‚unit‘ => ‚pt‘, ‚number‘ => 45,
    ‚format‘ => ‚flat‘, ‚orderby‘ => ‚name‘, ‚order‘ => ‚ASC‘
    );
    $args = wp_parse_args( $args, $defaults );
    extract($args);

    if ( !$tags )
    return;
    $counts = $tag_links = array();
    foreach ( (array) $tags as $tag ) {
    $counts[$tag->name] = $tag->count;
    $tag_links[$tag->name] = get_tag_link( $tag->term_id );
    if ( is_wp_error( $tag_links[$tag->name] ) )
    return $tag_links[$tag->name];
    $tag_ids[$tag->name] = $tag->term_id;
    }

    $min_count = min($counts);
    $spread = max($counts) – $min_count;
    if ( $spread <= 0 ) $spread = 1; $font_spread = $largest - $smallest; if ( $font_spread <= 0 ) $font_spread = 1; $font_step = $font_spread / $spread; // SQL cannot save you; this is a second (potentially different) sort on a subset of data. if ( 'name' == $orderby ) uksort($counts, 'strnatcasecmp'); else asort($counts); if ( 'DESC' == $order ) $counts = array_reverse( $counts, true ); $a = array(); $rel = ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ) ? ‚ rel=“tag“‚ : “;

    foreach ( $counts as $tag => $count ) {
    $tag_id = $tag_ids[$tag];
    $tag_link = clean_url($tag_links[$tag]);
    $tag = str_replace(‚ ‚, ‚ ‚, wp_specialchars( $tag ));
    $a[] = „\t„;
    }

    switch ( $format ) :
    case ‚array‘ :
    $return =& $a;
    break;
    case ‚list‘ :
    $return = „

      \n\t

    • „;
      $return .= join(„
    • \n\t

    • „, $a);
      $return .= „
    • \n

    \n“;
    break;
    default :
    $return = join(„\n“, $a);
    break;
    endswitch;

    return apply_filters( ‚dropdown_generate_tag_cloud‘, $return, $tags, $args );
    }
    ?>
    \—

    Do sidebaru pak vložíme kód roletky

    /—code php

    \—

    **Zdroj:**
    „http://hackwordpress.com/how-to-display-wordpress-tags-dropdown-menu/“:http://hackwordpress.com/how-to-display-wordpress-tags-dropdown-menu/

    Implementováno na tomto webu.

    Filtrování podle několika tagů současně

    **Sk Multi Tag**
    „http://wordpress.org/extend/plugins/sk-multi-tag/“:http://wordpress.org/extend/plugins/sk-multi-tag/
    „http://www.skipstorm.org/2009/06/sk-multi-tag/“:http://www.skipstorm.org/2009/06/sk-multi-tag/

    This plugin adds a tag cloud widget where you can select multiple tags at once.

    Implementováno na tomto webu.

    **Úpravy:**

    V editaci pluginu lze nastavit jednotnou velikost tagů zobrazených v cloudu a doplnit do „definičního pole cloudu“:http://codex.wordpress.org/Template_Tags/wp_generate_tag_cloud oddělovač tagů. Roletka s tagy přidána pomocí „funkcí vzhledu“:https://wordpresso.ovx.cz/roletka-s-tagy-v-sidebaru/.

    *Alternativy*

    **MultiTags**
    „http://wordpress.org/extend/plugins/multitags/“:http://wordpress.org/extend/plugins/multitags/
    „http://www.vogel-nest.de/wp_multitags_plugin“:http://www.vogel-nest.de/wp_multitags_plugin