-
Search Results
-
Topic: Grid Loop Orderby Issues
(The site is http://www.nantucket-bucket.com/, but it has a maintenance screen up so you can’t see it…)
I have added the grid loop and am trying to get posts to order alphabetically by title, but orderby doesn't seem to be working. Here is the code:
/**
* Possibly amend the loop.
*
* Specify the conditions under which the grid loop should be used.
*
* @author Bill Erickson
* @author Gary Jones
* @link http://code.garyjones.co.uk/genesis-grid-loop-advanced/
*
* @return boolean Return true of doing the grid loop, false if not.
*/
function child_is_doing_grid_loop() {// Amend this conditional to pick where this grid looping occurs.
// This says to use the grid loop everywhere except single posts,
// single pages and single attachments.
return ( ! is_singular() );}
/**
* Grid Loop Arguments
*
* Specify all the desired grid loop and query arguments
*
* @author Bill Erickson
* @author Gary Jones
* @link http://code.garyjones.co.uk/genesis-grid-loop-advanced/
*
* @return array $arguments
*/
function child_grid_loop_arguments() {$grid_args = array(
'orderby' => 'title',
'order' => 'ASC',
'features' => 0,
'feature_content_limit' => 0,
'feature_image_size' => 0,
'feature_image_class' => 'aligncenter post-image',
'grid_content_limit' => 0,
'grid_image_size' => 'grid-thumbnail',
'grid_image_class' => 'aligncenter post-image',
'more' => __( 'Continue reading →', 'genesis' ),);
$query_args = array(
'posts_per_page' => 15,
);return array(
'grid_args' => $grid_args,
'query_args' => $query_args,
);
}add_action( 'genesis_before_loop', 'child_prepare_grid_loop' );
/**
* Prepare Grid Loop.
*
* Swap out the standard loop with the grid and apply classes.
*
* @author Gary Jones
* @author Bill Erickson
* @link http://code.garyjones.co.uk/genesis-grid-loop-advanced/
*/
function child_prepare_grid_loop() {if ( child_is_doing_grid_loop() ) {
// Remove the standard loop
remove_action( 'genesis_loop', 'genesis_do_loop' );// Use the prepared grid loop
add_action( 'genesis_loop', 'child_do_grid_loop' );// Add some extra post classes to the grid loop so we can style the columns
add_filter( 'genesis_grid_loop_post_class', 'child_grid_loop_post_class' );
}}
add_action( 'pre_get_posts', 'child_grid_query' );
/**
* Grid query to get the posts that will appear in the grid.
*
* Any changes to the actual query (posts per page, category…) should be here.
*
* @author Bill Erickson
* @author Gary Jones
* @link http://code.garyjones.co.uk/genesis-grid-loop-advanced/
*
* @param WP_Query $query
*/
function child_grid_query( $query ) {// Only apply to main query, if this matches our grid query conditional, and if it isn't in the back-end
if ( $query->is_main_query() && child_is_doing_grid_loop() && ! is_admin() ) {// Get all arguments
$args = child_grid_loop_arguments();// Don't edit below, this does the logic to figure out how many posts on each page
$posts_per_page = $args['query_args']['posts_per_page'];
$features = $args['grid_args']['features'];
$offset = 0;
$paged = $query->query_vars['paged'];
if ( 0 == $paged )
// If first page, add number of features to grid posts, so balance is maintained
$posts_per_page += $features;
else
// Keep the offset maintained from our page 1 adjustment
$offset = ( $paged - 1 ) * $posts_per_page + $features;$query->set( 'posts_per_page', $posts_per_page );
$query->set( 'offset', $offset );
}}
/**
* Prepare the grid loop.
*
* Only use grid-specific arguments. All query args should be done in the
* child_grid_query() function.
*
* @author Gary Jones
* @author Bill Erickson
* @link http://code.garyjones.co.uk/genesis-grid-loop-advanced/
*
* @uses genesis_grid_loop() Requires Genesis 1.5
*
* @global WP_Query $wp_query Post query object.
*/
function child_do_grid_loop() {global $wp_query;
// Grid specific arguments
$all_args = child_grid_loop_arguments();
$grid_args = $all_args['grid_args'];// Combine with original query
$args = array_merge( $wp_query->query_vars, $grid_args );// Create the Grid Loop
genesis_grid_loop( $args );}
/**
* Add some extra body classes to grid posts.
*
* Change the $columns value to alter how many columns wide the grid uses.
*
* @author Gary Jones
* @author Bill Erickson
* @link http://code.garyjones.co.uk/genesis-grid-loop-advanced/
*
* @global array $_genesis_loop_args
* @global integer $loop_counter
*
* @param array $grid_classes
*/
function child_grid_loop_post_class( $grid_classes ) {global $_genesis_loop_args, $loop_counter;
// Alter this number to change the number of columns - used to add class names
$columns = 3;// Be able to convert the number of columns to the class name in Genesis
$fractions = array( '', 'half', 'third', 'fourth', 'fifth', 'sixth' );// Only want extra classes on grid posts, not feature posts
if ( $loop_counter >= $_genesis_loop_args['features'] ) {
// Make a note of which column we're in
$column_number = ( ( $loop_counter - $_genesis_loop_args['features'] ) % $columns ) + 1;// Add genesis-grid-column-? class to know how many columns across we are
$grid_classes[] = sprintf( 'genesis-grid-column-%d', $column_number );// Add one-* class to make it correct width
$grid_classes[] = sprintf( 'one-' . $fractions[$columns - 1], $columns );// Add a class to the first column, so we're sure of starting a new row with no padding-left
if ( 1 == $column_number )
$grid_classes[] = 'first';
}return $grid_classes;
}
Any ideas on why this isn't working?
Mother. Web & Graphic Designer. Lactation Consultant. Blogging about how it all fits together, most recently from northern Colorado. Visit my blog or my design site.
I had the DCG set full page width on several other sites. Then after upgrade to Gen. 1.9 and a problem I created myself (had spaces in theme folder names. Now fixed) Had to go back to all affected sites and readjust things, widgets, header & backgrounds, etc. Anyways, this site has a full page width DCG and I went and check to make I did this. But the DCG is still overlapping the side bar.
Thanks in advance,
Steve
Steve Adams | 316 Design | 619.726.9923
We live the lifestyles that we promote.™Topic: dropdown nav width
How do I change the width of the drop-down menu to auto-adjust to the length of the page title? Right now it is at a fixed width so some items run down to 4 lines or more with longer page titles. I am sure this is a simple css fix for those in the know, not a newb like me. I searched around online and found a css trick that worked, but the page title auto adjusted but the shadow background did not so the text ran off the color and it looked horrible. Could not figure out how to make it work right. I also searched the forum before posting. Thanks!!
[Resolved]Topic: Moving the sidebar divider
Hello,
I am using the Education theme and have found that all of my content is spilling out into the secondary sidebar when browser is not at full width. I did "move" the primary sidebar so that it displays under my content and adjusted the width of the content area.
It doesn't seem to affect the home page, but ALL INNER PAGES OF THE SITE.
If anyone has any ideas on what I did to break the layout, I would truly appreciate it.
Thanks, Lisa
Topic: Agentpress Main Page
Hello,
AgentPress will help my friend simplified his life by being able list his properties but I am looking for someone to customize the main page by creating a slider similar to the one found at http://themeforest.net/item/gymboom-a-responsive-fitness-gym-template/full_screen_preview/2794938 and possibly remove many of the elements found on the main page of the AgentPress theme ( http://demo.studiopress.com/agentpress/ ) and with out affecting how the theme works if we decided to bring some of the elements back in the future.
We want to make a very simple homepage with a large slider and a few feature property listings. We will remove most of the header, adjust width of the listed "From the Blog" since we will also remove the nesletter and testimonials, The slider will also be wider then the current image because we will remove the property listing, We will also remove most of the sections in the footer.
I am family enough remove sections and adjust the with. But, now familiar how to create a slider that can load an image and overlap some text.
If you can help with this please let me know if your hourly rate or a flat rate.
Thank you for your time,
- Dave
Welcome!
These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.