Multiple $args in array in 'genesis_grid_loop_args' filter?
-
Hello, I’m trying to put more than one
$arg
in thegenesis_grid_loop_args
filter but I’m not coming up with the correct syntax.I’m trying to do something like the following (note: the following does not work):
function page_grid_args( $args, $query ) { if( is_post_type_archive( 'press' )) $args = array( 'features_on_front' = 0, 'teasers_on_front' = 4, 'teaser_columns' = 4) return $args; } add_filter( 'genesis_grid_loop_args', 'page_grid_args', 10, 2 );
I came up with the following work-around, which does work, but I’m not sure its “proper” code syntax:
function page_grid_args( $args, $query ) { if( is_post_type_archive( 'press' )) $args['features_on_front'] = 0; if( is_post_type_archive( 'press' )) $args['teaser_columns'] = 3; if( is_post_type_archive( 'press' )) $args['teasers_on_front'] = 9; if( is_post_type_archive( 'press' )) $args['features_on_front'] = 1; return $args; } add_filter( 'genesis_grid_loop_args', 'page_grid_args', 10, 2 );
Like I mentioned, this works but it seems pretty clunky, codewise, so I’m wondering if someone has a way to put the
$args
in an array within a singleif statement
.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Multiple $args in array in 'genesis_grid_loop_args' filter?’ is closed to new replies.