Search by Cuisine or Course
-
I’ve made a quick addition to recipe-hero/templates/archive.php to add a dropdown of links for “cuisine”, which I use for featured “ingredients” that are sold on my site.
Just thought others might be interested: https://sunshineinabottle.com/recipes/
Thanks to vladff for the code which I just added to the top of archive.php right after <?php get_header(); ?>
Here’s the code (and html) I used:
<div class=”recipe-dropdown”>
<div class=”recipe-search”>Search by Ingredient</div>
<div class=”recipe-dropdown-content”>-
<li class=”cat-item”>All
<?php
$cuisine_args = array(
‘orderby’ => ‘name’,
‘order’ => ‘ASC’,
‘taxonomy’ => ‘cuisine’,
‘title_li’ => ”,
);
wp_list_categories( $cuisine_args );
?></div>
</div>Here’s the CSS:
.recipe-search {
padding:10px 20px;
border-radius:3px;
border:2px solid #50a64d;
color:#777;
background-color:#fff;
}.recipe-dropdown {
position: absolute;
display: inline-block;
top:115px;
right:100px;
z-index:99;
}.recipe-dropdown-content {
max-height:0px;
position: absolute;
transition-duration:0.5s;
background-color:#fff;
padding:0px;
overflow:scroll;
margin-top:-2px;
border-left:2px solid #50a64d;
border-right:2px solid #50a64d;
border-bottom:2px solid #50a64d;
border-bottom-left-radius:3px;
border-bottom-right-radius:3px;
}.recipe-dropdown:hover .recipe-dropdown-content {
transition-duration:0.5s;
max-height:400px;
}.recipe-dropdown-content .cat-item {
padding: 5px 18px;
line-height:110%;
}
- The topic ‘Search by Cuisine or Course’ is closed to new replies.