Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/**
* Template Name: Foodie-Pro-Style Recipe Index
*
* Replace the entire contents your cookdpro/templates/page-recipes.php with the contents of this file
* Make sure to use the content-sidebar layout (default), not secondary-sidebar-content layout
*
* @package CookdPro
* @copyright Copyright (c) 2019, Feast Design Co.
* @license GPL-2.0+
* @since 4.2.0
*/
?>
<style>
/* Recipes Page
--------------------------------------------- */
.recipe-index-search {
border-bottom: 1px solid #eee;
padding: 21px 0;
}
.recipe-index-search .widget {
float: left;
margin-right: 3%;
width: 31%;
}
.recipe-index-search .widget:nth-child(3) {
margin-right: 0;
}
.recipe-index-search .search-form {
border: 0;
border-bottom: 1px solid #eee;
padding: 0 11px;
}
.recipe-index-search select {
height:50px;
}
.recipe-index-featured-posts {
margin-top: 21px;
}
.recipe-index-featured-posts .widget {
border-bottom: 1px solid #eee;
clear: both;
display: block;
overflow: hidden;
padding: 20px 0;
}
</style>
<?php
add_action( 'genesis_meta', 'cookd_pro_recipes_genesis_meta' );
/**
* Add widget support for recipes page.
* If no widgets active, display the default page content.
*
* @since 4.2.0
*/
function cookd_pro_recipes_genesis_meta() {
if ( is_active_sidebar( 'recipe-index-search' ) || is_active_sidebar( 'recipe-index-featured-posts' ) ) {
// Remove the default Genesis loop.
remove_action( 'genesis_loop', 'genesis_do_loop' );
// Add a custom loop for the home page.
add_action( 'genesis_loop', 'cookd_pro_recipes_loop_helper' );
}
}
/**
* Display the recipe page widgeted sections.
*
* @since 4.2.0
*/
function cookd_pro_recipes_loop_helper() {
genesis_widget_area( 'recipe-index-search', array(
'before' => '<div class="widget-area recipe-index-search">',
'after' => '</div> <!-- end .recipe-index-search -->',
) );
genesis_widget_area( 'recipe-index-featured-posts', array(
'before' => '<div class="widget-area recipe-index-featured-posts">',
'after' => '</div> <!-- end .recipe-index-featured-posts -->',
) );
}
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment