This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_cat( $_slug ) { | |
$_categories = get_terms( 'category', array( 'hide_empty' => false, 'order' => 'ASC' ) ); | |
$_result = array_values( array_filter( $_categories, function($obj){ | |
if (isset($obj->slug)) { | |
if( $obj->slug == [needle] ): | |
$_term_id = $obj->term_id; | |
return true; | |
endif; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
page_through_array: function( page_size, page_number ) { | |
return = _array.slice( ( page_number - 1 ) * page_size, page_number * page_size ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$_args = array ( | |
'post_type' => %post_type%, | |
'tax_query' => array ( | |
array ( 'taxonomy' => %tax_name%, 'field'=> 'term_id', 'terms' => %term_id% ), | |
), | |
'meta_query' => array ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function update_agenda_archive($query) { | |
if ( !is_admin() && $query->is_post_type_archive('agenda') ) { | |
$_today = date('Ymd'); | |
$query->set('meta_key', 'event__start_date'); | |
$query->set('orderby', 'meta_value_num'); | |
$query->set('order', 'ASC'); | |
$query->set('meta_query', array( | |
array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function update_archive( $query ) { | |
$query->set('meta_query' , array( | |
'day_clause' => array( 'key' => 'event__day' ), | |
'time_clause' => array( 'key' => 'event__start_time' ))); | |
$query->set('orderby' , array( 'day_clause' => 'ASC', 'time_clause' => 'ASC' )); | |
} | |
add_action( 'pre_get_posts', 'update_archive' ); |