is_main_query() ) { if ( is_archive() ) { // Date validation. $result = preg_match( '/^([0-9]+)$/',$archives_category_date_year ); $res = strlen( $archives_category_date_year ); if ( $archives_category_date_month_no > 0 && $archives_category_date_month_no < 13 && is_numeric( $archives_category_date_month_no ) ) { if ( $result && 4 === $res ) { $query->set( 'cat', $archives_category_date_category ); $query->set( 'year', $archives_category_date_year ); $query->set( 'monthnum', $archives_category_date_month_no ); } } } } } add_action( 'pre_get_posts', 'archives_category_date_posts_by_date' ); /** * Function will return the Month Slug Type. * * @return String Month Slug. */ function get_archives_category_date_month_slug_type() { return apply_filters( 'get_archives_category_date_month_slug_type', 'abbrev' ); // options : abbrev / numeric } /** * Widget file included. */ require_once( ACD_BASE_PATH . '/widget/acd-widget.php' );