Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!--?php
- //get subcat variables
- add_action('genesis_before_loop','dswp_termtitle');
- add_action('genesis_before_loop','dswp_listsubcats');
- //display term title
- function dswp_termtitle() {
- $title = '<h2 class="term-title"-->';
- $title .= single_term_title('', false );
- $title .= '';
- echo $title;
- }
- //list subcategories or siblings
- function dswp_listsubcats () {
- foreach (get_the_category('') as $category);
- $cat = get_query_var('cat');
- $cat_id=$category->cat_ID;
- $child_cats = get_categories('child_of='.$cat);
- if ($child_cats) { $args = array(
- 'title_li' => '',
- 'depth' => 1,
- 'echo' => 1,
- 'child_of' => $cat
- ); ?>
- <ul class="cats">
- <?php wp_list_categories($args); ?-->
- </ul>
- <!--?php }
- }
- //loop additions
- //REPLACE THE ONE WITH YOUR CATEGORY ID
- if (is_category_or_sub(25)) {
- remove_action('genesis_after_post_content', 'genesis_post_meta');
- remove_action('genesis_before_post_content', 'genesis_post_info');
- add_action('genesis_before_post_title', 'dswp_grid_loop_image');
- add_action('genesis_after_post', 'dswp_grid_divider');
- }
- // Use the prepared grid loop & new image
- //REPLACE THE 1 WITH YOUR CATEGORY ID
- if (is_category_or_sub(25)) {
- remove_action( 'genesis_loop', 'genesis_do_loop' );
- add_action( 'genesis_loop', 'dswp_grid_helper' );
- }
- //grid loop image function
- function dswp_grid_loop_image() {
- if ( in_array( 'genesis-grid', get_post_class() ) ) {
- global $post;
- echo '<p class="thumbnail"--><a href="'.get_permalink().'">'.get_the_post_thumbnail($post->ID, 'thumbnail').'</a><p></p>';
- }
- }
- /**
- * Grid Loop Divider
- * @author Bill Erickson
- * @link http://www.billerickson.net/genesis-grid-loop-content/
- *
- */
- function dswp_grid_divider() {
- global $loop_counter, $paged;
- if ((($loop_counter + 1) % 3 == 0) && !($paged == 0 && $loop_counter < 2) ) echo '<hr>';
- }
- //grid function
- function dswp_grid_helper() {
- // Ensure the arguments for the normal query for the page are carried forwards
- global $query_string, $paged;
- // If you're using a Page to query the posts (e.g. with the Blog template), comment out the next line.
- wp_parse_str( $query_string, $query_args );
- $grid_args = array(
- 'features' => 0,
- 'feature_image_size' => 0,
- 'feature_image_class' => 'alignleft post-image',
- 'feature_content_limit' => 0,
- 'grid_image_size' => '0',
- 'grid_image_class' => 'alignleft post-image',
- 'grid_content_limit' => -1,
- 'more' => __( '', 'genesis' ),
- //change this if you would like more or less photos per page
- 'posts_per_page' => 24,
- );
- // Make sure the first page has a balanced grid
- if ( 0 == $paged )
- // If first page, add number of features to grid posts, so balance is maintained
- $grid_args['posts_per_page'] += $grid_args['features'];
- else
- // Keep the offset maintained from our page 1 adjustment
- $grid_args['offset'] = ( $paged - 1 ) * $grid_args['posts_per_page'] + $grid_args['features'];
- // Merge the standard query for this page, and our preferred loop arguments
- genesis_grid_loop( array_merge( (array) $query_args, $grid_args ) );
- }
- genesis();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement