diff --git a/archive-event.php b/archive-event.php new file mode 100644 index 0000000..925d1c8 --- /dev/null +++ b/archive-event.php @@ -0,0 +1,77 @@ + 'event', + 'meta_key' => '_event_start_date', // load up the event_date meta + 'orderby' => 'meta_value', // sort by the event_date + 'order' => 'asc', + 'posts_per_page'=> '12', + 'paged' => $paged, + 'meta_query' => array( // WordPress has all the results, now, return only the events after today's date + array( + 'key' => '_event_start_date', // Check the start date field + 'value' => date("Y-m-d"), // Set today's date (note the similar format) + 'compare' => '>=', // Return the ones greater than today's date + 'type' => 'DATE' // Let WordPress know we're working with date + ) + ), + ); + + genesis_custom_loop( wp_parse_args($query_args, $args) ); + +} + + +//add_action( 'genesis_loop', 'custom_do_grid_loop' ); // Add custom loop +function custom_do_grid_loop() { + + $args = array( + 'post_type' => 'event', // enter your custom post type + 'meta_key' => '_event_start_date', // load up the event_date meta + 'orderby' => 'meta_value', // sort by the event_date + 'order' => 'asc', + 'posts_per_page'=> '6', // overrides posts per page in theme settings + 'meta_query' => array( // WordPress has all the results, now, return only the events after today's date + array( + 'key' => '_event-start-date', // Check the start date field + 'value' => date("Y-m-d"), // Set today's date (note the similar format) + 'compare' => '>=', // Return the ones greater than today's date + 'type' => 'DATE' // Let WordPress know we're working with date + ) + ), + ); + $loop = new WP_Query( $args ); + if( $loop->have_posts() ): + + while( $loop->have_posts() ): $loop->the_post(); global $post; + echo '
'; + echo '
'; + echo '
'. get_the_post_thumbnail( $id, array(150,150) ).'
'; + echo '
'; + echo '
'; + echo '

' . get_the_title() . '

'; + echo '
'; + echo '
'; + + endwhile; + + endif; + +} + +/** Remove Post Info */ +remove_action('genesis_before_post_content','genesis_post_info'); +remove_action('genesis_after_post_content','genesis_post_meta'); + +genesis(); \ No newline at end of file diff --git a/functions.php b/functions.php index 86da14e..faf1301 100755 --- a/functions.php +++ b/functions.php @@ -373,4 +373,7 @@ function abte_add_site_description_class( $attributes ) { $attributes['class'] .= ' screen-reader-text'; return $attributes; -} \ No newline at end of file +} + +//Add post type archive support +add_post_type_support( 'event', 'genesis-cpt-archives-settings' );