Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * This is Category file.
- *
- * @package Genesis-Child-Theme
- * @since 1.0.0
- */
- /**
- * Genesis custom loop
- */
- /** Replace the standard loop with our custom loop */
- remove_action ('genesis_loop', 'genesis_do_loop'); // Remove the standard loop
- add_action( 'genesis_loop', 'custom_do_press_loop' ); // Add custom loop
- function custom_do_press_loop() {
- $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
- $args = array(
- 'post_type' => 'post',
- 'cat' => 'category_name',
- 'posts_per_page' => 3,
- 'orderby' => 'date',
- 'order' => 'DSC',
- 'paged' => $paged
- );
- echo '<section>';
- /*
- Overwrite $wp_query with our new query.
- The only reason we're doing this is so the pagination functions work,
- since they use $wp_query. If pagination wasn't an issue,
- use: https://gist.github.com/3218106
- */
- global $wp_query;
- $temp = $wp_query;
- $wp_query = new WP_Query( $args );
- if( have_posts() ):
- while( have_posts() ): the_post();
- global $post;
- echo '<article>';
- echo '<div class="entry-content grey">';
- echo '<header class="entry-header block-link-entry-header">';
- echo '<h2 class="entry-title block-link-entry-title">' . get_the_title() . '</h2>';
- echo '</header>';
- echo '<p>' . get_the_date() . '</p>';
- echo '<p>' . get_the_excerpt() . '</p>';
- echo '</div>';
- echo '<a href="' . get_permalink() . '" class="block-link image-block-link">';
- echo get_the_post_thumbnail();
- echo '</a>';
- echo '</article>';
- endwhile;
- do_action( 'genesis_after_endwhile' );
- echo '</section>';
- wp_reset_query();
- endif;
- $wp_query = $temp;
- }
- genesis();
Add Comment
Please, Sign In to add comment