Community Forums › Forums › Archived Forums › Design Tips and Tricks › Minimum Pro: Two-Column Grid Within a Sidebar?
- This topic has 5 replies, 1 voice, and was last updated 11 years, 7 months ago by
jmrallen.
-
AuthorPosts
-
September 1, 2013 at 10:58 pm #60196
jmrallen
MemberThe Minimum Pro theme does the Genesis grid loop out of the box, but I don't want the loop to appear full-width. Instead, I want it to appear in a specific sidebar. I've found many references to creating custom grid loops, but I've not found any indication about whether those snippets work in Genesis 2.0, nor have I seen any advice about how to include a grid loop in a specific sidebar.
Is what I'm trying to achieve actually possible? I'd ideally like a two-column grid loop to appear (with some categories excluded) in the "home-middle-1" sidebar on my homepage (dev.dailygame.net). The complete functions.php code I'm using is below. Where might I put the grid loop info to get the two-column loop to work in the home-middle-1 sidebar?
<?php
//* Enqueue scripts
add_action( 'wp_enqueue_scripts', 'minimum_front_page_enqueue_scripts' );
function minimum_front_page_enqueue_scripts() {//* Load scripts only if custom background is being used
if ( ! get_background_image() )
return;//* Enqueue Backstretch scripts
wp_enqueue_script( 'minimum-backstretch', get_bloginfo( 'stylesheet_directory' ) . '/js/backstretch.js', array( 'jquery' ), '1.0.0' );
wp_enqueue_script( 'minimum-backstretch-set', get_bloginfo('stylesheet_directory').'/js/backstretch-set.js' , array( 'jquery', 'minimum-backstretch' ), '1.0.0' );
wp_localize_script( 'minimum-backstretch-set', 'BackStretchImg', array( 'src' => get_background_image() ) );//* Add custom body class
add_filter( 'body_class', 'minimum_add_body_class' );
}//* Minimum custom body class
function minimum_add_body_class( $classes ) {
$classes[] = 'minimum';
return $classes;
}//* Add widget support for homepage if widgets are being used
add_action( 'genesis_meta', 'minimum_front_page_genesis_meta' );
function minimum_front_page_genesis_meta() {if ( is_home() ) {
//* Remove entry footer functions
remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );//* Force full width content layout
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
}if ( is_active_sidebar( 'home-featured-full' ) || is_active_sidebar( 'home-featured-left' ) || is_active_sidebar( 'home-featured-right' ) || is_active_sidebar( 'home-middle-1' ) || is_active_sidebar( 'home-middle-2' ) ) {
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
add_action( 'genesis_before_content', 'sc_home_do_featured' );
add_action( 'genesis_before_content', 'sc_home_do_middle' );
}
}// Home feature widget section
function sc_home_do_featured() {if ( is_active_sidebar( 'home-featured-full' ) || is_active_sidebar( 'home-featured-left' ) || is_active_sidebar( 'home-featured-right' ) ) {
echo '<section id="home-featured" class="clearfix"><div class="wrap">';
genesis_widget_area( 'home-featured-full', array(
'before' => '<main class="home-featured-full">',
'after' => '</main>',
) );echo '<section id="home-featured-halves">';
genesis_widget_area( 'home-featured-left', array(
'before' => '<aside class="home-featured-left one-half first">',
'after' => '</aside>',
) );genesis_widget_area( 'home-featured-right', array(
'before' => '<aside class="home-featured-right one-half">',
'after' => '</aside>',
) );echo '</section><!-- end home-featured-halves --></div><!-- end wrap --></section><!-- end home-featured -->';
}
}// Home middle widget section
function sc_home_do_middle() {if ( is_active_sidebar( 'home-middle-1' ) || is_active_sidebar( 'home-middle-2' ) ) {
echo '<section id="home-middle" class="clearfix"><div class="wrap">';
genesis_widget_area( 'home-middle-1', array(
'before' => '<aside class="home-middle-1 widget-area two-thirds first">',
'after' => '</aside>',
) );genesis_widget_area( 'home-middle-2', array(
'before' => '<aside class="home-middle-2 widget-area one-third">',
'after' => '</aside>',
) );echo '</div><!-- end wrap --></section><!-- end home-middle -->';
}
}//* Genesis grid loop
function minimum_grid_loop_helper() {if ( function_exists( 'genesis_grid_loop' ) ) {
genesis_grid_loop( array(
'features' => 0,
'feature_image_size' => 0,
'feature_content_limit' => 0,
'grid_image_size' => 0,
'grid_content_limit' => 250,
'more' => __( '[Read more]', 'minimum' ),
) );
} else {genesis_standard_loop();
}
}//* Run the Genesis loop
genesis();September 2, 2013 at 9:12 am #60256jmrallen
MemberIt occurred to me that I failed to include the front-page.php info. I currently have the area setup as a widget and am making the content appear in a single column via the Featured Widget Amplified plugin. If I can get the grid system working in that area, then I could simply un-register that widget from the homepage. Anyway, I'm obviously more of a content guy than a code guy, so I really appreciate the help from this community. Here's hoping that what I want to achieve is actually feasible. Here's the front-page.php code I'm currently using:
<?php
//* Enqueue scripts
add_action( 'wp_enqueue_scripts', 'minimum_front_page_enqueue_scripts' );
function minimum_front_page_enqueue_scripts() {//* Load scripts only if custom background is being used
if ( ! get_background_image() )
return;//* Enqueue Backstretch scripts
wp_enqueue_script( 'minimum-backstretch', get_bloginfo( 'stylesheet_directory' ) . '/js/backstretch.js', array( 'jquery' ), '1.0.0' );
wp_enqueue_script( 'minimum-backstretch-set', get_bloginfo('stylesheet_directory').'/js/backstretch-set.js' , array( 'jquery', 'minimum-backstretch' ), '1.0.0' );
wp_localize_script( 'minimum-backstretch-set', 'BackStretchImg', array( 'src' => get_background_image() ) );//* Add custom body class
add_filter( 'body_class', 'minimum_add_body_class' );}
//* Minimum custom body class
function minimum_add_body_class( $classes ) {
$classes[] = 'minimum';
return $classes;
}//* Add widget support for homepage if widgets are being used
add_action( 'genesis_meta', 'minimum_front_page_genesis_meta' );
function minimum_front_page_genesis_meta() {if ( is_home() ) {
//* Remove entry footer functions
remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );//* Force full width content layout
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );}
if ( is_active_sidebar( 'home-featured-full' ) || is_active_sidebar( 'home-featured-left' ) || is_active_sidebar( 'home-featured-right' ) || is_active_sidebar( 'home-middle-1' ) || is_active_sidebar( 'home-middle-2' ) ) {
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
add_action( 'genesis_before_content', 'sc_home_do_featured' );
add_action( 'genesis_before_content', 'sc_home_do_middle' );
}}
// Home feature widget section
function sc_home_do_featured() {if ( is_active_sidebar( 'home-featured-full' ) || is_active_sidebar( 'home-featured-left' ) || is_active_sidebar( 'home-featured-right' ) ) {
echo '<section id="home-featured" class="clearfix"><div class="wrap">';
genesis_widget_area( 'home-featured-full', array(
'before' => '<main class="home-featured-full">',
'after' => '</main>',
) );echo '<section id="home-featured-halves">';
genesis_widget_area( 'home-featured-left', array(
'before' => '<aside class="home-featured-left one-half first">',
'after' => '</aside>',
) );genesis_widget_area( 'home-featured-right', array(
'before' => '<aside class="home-featured-right one-half">',
'after' => '</aside>',
) );echo '</section><!-- end home-featured-halves --></div><!-- end wrap --></section><!-- end home-featured -->';
}
}// Home middle widget section
function sc_home_do_middle() {
if ( is_active_sidebar( 'home-middle-1' ) || is_active_sidebar( 'home-middle-2' ) ) {
echo '<section id="home-middle" class="clearfix"><div class="wrap">';
genesis_widget_area( 'home-middle-1', array(
'before' => '<aside class="home-middle-1 widget-area two-thirds first">',
'after' => '</aside>',
) );genesis_widget_area( 'home-middle-2', array(
'before' => '<aside class="home-middle-2 widget-area one-third">',
'after' => '</aside>',
) );echo '</div><!-- end wrap --></section><!-- end home-middle -->';
}
}//* Genesis grid loop
function minimum_grid_loop_helper() {if ( function_exists( 'genesis_grid_loop' ) ) {
genesis_grid_loop( array(
'features' => 0,
'feature_image_size' => 0,
'feature_content_limit' => 0,
'grid_image_size' => 0,
'grid_content_limit' => 250,
'more' => __( '[Read more]', 'minimum' ),
) );
} else {genesis_standard_loop();
}
}
//* Run the Genesis loop
genesis();September 2, 2013 at 2:36 pm #60294jmrallen
MemberAfter more searching, I found a great post by Bill Erickson about the grid loop that discussed using "one-third" to determine how columns are displayed (in that case, a three-column layout). For the life of me, I can't figure out how to keep one-third from meaning "one third of the entire page" rather than "one-third of the specific space I'm trying to fill."
I tried getting the grid appear just in a specific div, but I kept failing miserably. Again, I'm positive this is just my coding inabilities at work.... I'm now fairly certain there's a solution, and it's just a matter of me not knowing how to achieve it. I'm hoping someone here knows how to pull this off in HTML5 / Genesis 2.0.
September 3, 2013 at 8:40 pm #60552jmrallen
MemberI installed the Genesis Grid Loop plugin by Bill Erickson and got the approximate intended effect on the homepage (see it here). I therefore know this is possible. However, I have no idea how to code this same functionality using functions.php and front-page.php rather than the plugin. Is there anyone out there who can help? I just don't know enough about reading code to figure it out on my own.
I would prefer to not use the plugin for two reasons: it's not been tested with Genesis 2.0, so something's bound to be not quite right, and I'd like to minimize the number of plugins in general. Any assistance this community can provide would be most appreciated. Once I get the functionality dialed in, I think I should be able to take the styling from there.
September 4, 2013 at 10:15 pm #60770jmrallen
MemberI made some more customizations to the theme today, and I noticed that the grid loop plugin didn't exactly do what I'd hoped. It definitely got the grid setup on the front page's main content area, but all of the single entries ended up having the grid applied to their sidebar area. I've no idea why, so I think I'm back to square one in my need to figure out how to code this in functions.php and front-page.php. I'll keep everyone posted as I tinker and discover more. And, as always, if any of the grid and functions experts here want to chime in, I'm completely open to guidance.
September 5, 2013 at 7:58 am #60827jmrallen
MemberYou can disregard the coding above, although I'm still trying to find a solution to the issue. I've continued to modify the site trying to find workarounds, so that code's largely not current. I tried to modify those two forum posts, but I couldn't find a way to do it to remove the code.
StudioPress support emailed me saying that there is a solution to this, but they don't have the code ready for copy/paste to send over. So, I'm either beholden to the community here or need to find one of their approved designers to help on a paid basis. I'm not necessarily opposed to that, so long as there's some reassurance that it's not a decades-long process that's billed by the hour. 🙂
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.