Community Forums › Forums › Archived Forums › Design Tips and Tricks › Widgetized page
- This topic has 12 replies, 2 voices, and was last updated 10 years, 2 months ago by masonjarsalads.
-
AuthorPosts
-
January 6, 2014 at 8:53 pm #83718masonjarsaladsMember
Hi again, I am trying to make an image index for the recipes page using the categories I've set up. I believe I've followed these instructions to a tee but I am missing something because I can't find the widgets. Would someone mind taking a look?
http://journalxtra.com/easyguides/how-to-create-genesis-page-template-widgets/
Here's the template...
<?php /*
Template Name: Recipe Template
*/ ?><?php
add_action( 'genesis_meta', 'sample_theme_recipe_template_genesis_meta' );
/**
* Add widget support for this template. If no widgets are active, display the default Genesis loop.
*
*/function sample_theme_recipe_template_genesis_meta() {
if ( is_active_sidebar( 'recipe-template-category-one' ) || is_active_sidebar( 'recipe-template-category-two' ) ) {
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'sample_theme_recipe_template_category_one' );
add_action( 'genesis_loop', 'sample_theme_recipe_template_category_two' );
add_filter( 'body_class', 'add_body_class' );function add_body_class( $classes ) {
$classes[] = 'sample-theme-recipe-template';
return $classes;
}}
}function sample_theme_recipe_template_category_one() {
if ( is_active_sidebar( 'recipe-template-category-one' ) ) {
genesis_widget_area( 'recipe-template-category-one', array(
'before' => '<div class="recipe-template-category-one widget-area">',
) );
}}
function sample_theme_recipe_template_category_two() {
if ( is_active_sidebar( 'recipe-template-category-two' ) ) {
genesis_widget_area( 'recipe-template-category-two', array(
'before' => '<div class="recipe-template-category-two widget-area">',
) );
}}
genesis();
And here is what I've added to the function.php - maybe I didn't correctly identify the widets?
//* Register Widget Area
genesis_register_sidebar( array(
'id' => 'recipe-template-category-one',
'name' => __( 'Widget Name as it shows in Appearance>Widgets', 'sample-theme' ),
'description' => __( 'Description of your widget as it appears in Appearance>Widgets.', 'sample-theme' ),
) );Thanks, I've been trying to figure this out for a very long time.
http://www.masonjarsalads.comJanuary 6, 2014 at 9:05 pm #83723Brad DaltonParticipantCan't test that code because you embedded it in a web page. Please paste the code from the file into a Gist and embed the Gist here thanks,
I did notice you've only registered one new widget.
Also, the code used in that tutorial isn't good for HTML 5 themes.
January 6, 2014 at 9:13 pm #83725masonjarsaladsMemberThanks,
January 6, 2014 at 9:17 pm #83728masonjarsaladsMemberI'm trying to include the link to the gist here but it isn't working. I didn't realize that tutorial isn't good for HTML 5 themes I found it to be the most popularly recommended. Might you suggest a better way to create a photo index for recipes? I prefer not to use a plug-in if I can code it myself.
I'm using the sample theme.
Thanks for your help!
January 7, 2014 at 9:20 am #83805Brad DaltonParticipantPersonally, i would either create a custom post type with support for creating custom taxonomy types and use a portfolio style archive page.
The Executive theme includes all the best code for this. http://my.studiopress.com/themes/executive/
Or, create a widgetized custom page template which you can simply populate with widgets. http://wpsites.net/web-design/flexible-responsive-widgets-template-for-genesis/
Or you could add the Agency Pro's front page to the Sample theme http://wpsites.net/web-design/custom-portfolio-template-with-hover-effects-using-genesis-featured-posts-widget/
January 7, 2014 at 9:43 am #83810masonjarsaladsMemberThanks Brad, I really appreciate it. I will check out your suggestions.
January 7, 2014 at 1:46 pm #83861masonjarsaladsMemberI followed your tutorial for a widgetized custom page template. How can I populate a specific page with widgets? I set the template to "widgets template" but I can't seem to find the widgets. The only place that I can use them are on the home page.
Thanks again.
January 7, 2014 at 6:23 pm #83920Brad DaltonParticipantYou can use on any page. Populate the new widgets and then select the template from any page. You can then choose that page as your front page.
The code to register the widgets goes in your functions file.
January 7, 2014 at 8:19 pm #83936masonjarsaladsMemberSorry, I'm still new at this so bear with me. How do I populate the new widgets? I've registered them in my functions.php file. I can see the new template as an option but it looks just like any other page.
January 9, 2014 at 10:47 pm #84317Brad DaltonParticipantJanuary 10, 2014 at 1:31 pm #84477masonjarsaladsMemberI am clearly missing something, when I got to appearance>widgets it only affects the home page.
January 10, 2014 at 2:42 pm #84489Brad DaltonParticipantYes because its a template. How many pages did you want it to effect?
Otherwise you'll need to use a portfolio style archive which effects all your category archives.
January 10, 2014 at 3:01 pm #84495masonjarsaladsMember -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.