get_the_category and echo out link to child-most/deepest category
Might get_category_parents() be helpful? It outputs a list of all hierarchical parents of the given category.
Might get_category_parents() be helpful? It outputs a list of all hierarchical parents of the given category.
It was not so hard and I have solved the problem, so for any one else stuck, just add: if ( isset($_GET[‘search-type’]) == ‘by-ref’ ) { add_filter( ‘posts_search’, ‘__search_by_title_only’, 500, 2 ); } where ‘by-ref’ is set in form as input type=”hidden” name=”search-type” value=”by-ref”
You can make a custom page template for this specific search page http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates. Then set some $_GET variables (using a form with method GET). And do a custom query for these $_GET values: $date_query = new WP_Query( ‘year=” . $_GET[“year’] . ‘&monthnum=’ . $_GET[‘month’] . ‘&day=’ . $_GET[‘day’] ); Then your custom loop: <?php if … Read more
You can use an custom plugin for your custom fields function fb_custom_search_where($where) { // put the custom fields into an array $customs = array(‘custom_field1’, ‘custom_field2’, ‘custom_field3’); foreach( $customs as $custom ) { $query .= ” OR (“; $query .= “( m.meta_key = ‘$custom’ )”; $query .= ” AND ( m.meta_value LIKE ‘{$n}{$term}{$n}’ )”; $query .= … Read more
You could use the autocompleter plugin. It does exactly what you describe: it autocompletes half-typed tags and categories. You’d just need to tag your recipes with their ingredients.
Filter posts_where or posts_search. See this answer for a couple of examples.
this might be the cause: The $echo parameter is ignored when searchform.php is present. There is a issue in the WordPress Trac concerning this. from the codex: http://codex.wordpress.org/Function_Reference/get_search_form#Notes
Try WordPress › Relevanssi – A Better Search « WordPress Plugins
I found the solution… My functions page now looks like: <?php class dropdown extends Walker_CategoryDropdown { function start_el(&$output, $category, $depth, $args) { $pad = str_repeat(‘ ’, $depth * 3); $cat_name = apply_filters( ‘list_cats’, $category->name, $category ); $output .= “\t<option class=\”level-$depth\” value=\””.$category->slug.”\””; $output .= ‘>’; $output .= $pad.$cat_name; if ( $args[‘show_count’] ) $output .= ‘ (‘. $category->count .’)’; … Read more
Well I managed to solve this sort of… The answer was to use separate search input boxes for each custom field being searched. Here is my working solution if anyone ever stumbles across this. function display_all_products() { global $term; $term = trim(strip_tags($_POST[‘s’])); $refnoterm = trim(strip_tags($_POST[‘ref’])); $yrterm = trim(strip_tags($_POST[‘yr’])); if(!empty($_POST[‘s’]) || !empty($_POST[‘ref’]) || !empty($_POST[‘yr’])) { if(!empty($_POST[‘s’])) … Read more