Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- global $wp_query;
- function filter_where($where = '') {
- if( !is_admin() ){
- if( isset($_GET['dia']) )
- $where.= " AND DAY(meta_value) = '". $_GET['dia']. "'";
- if( isset($_GET['mes']) )
- $where.= " AND MONTH(meta_value) = '". $_GET['mes']. "'";
- if( isset($_GET['ano']) )
- $where.= " AND YEAR(meta_value) = '". $_GET['ano']. "'";
- }
- return $where;
- }
- add_filter('posts_where', 'filter_where');
- $args = array_merge( $wp_query->query, array( 'meta_key' => 'CUSTOM_FIELD_DATA', 'orderby' => 'meta_value', 'order' => 'desc' ) );
- query_posts( $args );
- //CUSTOM_FIELD_DATA: é o nome do seu custom field que contém a data. Lembrando que a data deve estar no formato YYYY-MM-DD
- ?>
Advertisement
Add Comment
Please, Sign In to add comment