max_num_pages <= 1 ) return; $paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1; $max = intval( $query->max_num_pages ); /** Add current page to the array */ if ( $paged >= 1 ) $links[] = $paged; /** Add the pages around the current page to the array */ if ( $paged >= 3 ) { $links[] = $paged - 1; $links[] = $paged - 2; } if ( ( $paged + 2 ) <= $max ) { $links[] = $paged + 2; $links[] = $paged + 1; } echo '' . "\n"; } /** * Adds PBC copyright * */ function pbc_copyright() { ?> Copyright © ÌÇÐÄlogo. All Rights Reserved. The PBC logo is a trademark of the ÌÇÐÄlogo. Legal Notice. query_vars['suppress_filters'])) { $query -> set('post_type', array('post', 'nav_menu_item', 'bid_tabulations', 'contractors', 'opportunities', 'projects')); return $query; } } add_filter('pre_get_posts', 'themeprefix_show_cpt_archives'); if ( ! function_exists( 'generate_featured_page_header_inside_single' ) ) : add_action('generate_before_content','generate_featured_page_header_inside_single', 10); function generate_featured_page_header_inside_single() { if ( function_exists( 'generate_page_header' ) ) { return; } if ( is_single() && get_post_type() != 'projects') { generate_featured_page_header_area('page-header-image-single'); } } endif; add_filter( 'pre_get_posts', 'alerts_archive_filter' ); function alerts_archive_filter($query) { if ( !is_admin() && is_post_type_archive( 'alerts' ) && $query -> is_main_query() ) { $yearQueryVar = get_query_var( 'year' ) == NULL ? date('Y') : get_query_var( 'year' ); $query->set( 'date_query', [ [ 'column' => 'post_date', 'before' => '- 30 days', 'inclusive' => true, ], [ 'year' => $yearQueryVar ] ] ); } return; } add_action('init', 'alerts_archive_rewrite'); function alerts_archive_rewrite() { add_rewrite_rule('^alerts/([0-9]{4})/?','index.php?post_type=alerts&year=$matches[1]','top'); } if( function_exists('acf_add_options_page') ) { //acf_add_options_page(); acf_add_options_page(array( 'page_title' => 'Wards', 'menu_title' => 'Wards', 'menu_slug' => 'ward-options', 'capability' => 'edit_posts', 'redirect' => false )); acf_add_options_page(array( 'page_title' => 'Community Areas', 'menu_title' => 'Community Areas', 'menu_slug' => 'community-area-options', 'capability' => 'edit_posts', 'redirect' => false )); acf_add_options_page(array( 'page_title' => 'Agencies', 'menu_title' => 'Agencies', 'menu_slug' => 'agencies-options', 'capability' => 'edit_posts', 'redirect' => false )); acf_add_options_page(array( 'page_title' => 'Bid Types', 'menu_title' => 'Bid Types', 'menu_slug' => 'bid-type-options', 'capability' => 'edit_posts', 'redirect' => false )); //acf_add_options_sub_page } if ( ! function_exists( 'generate_navigation_search' ) ) : /** * Add the search bar to the navigation * @since 1.1.4 */ add_action( 'generate_inside_navigation','generate_navigation_search'); function generate_navigation_search() { $generate_settings = wp_parse_args( get_option( 'generate_settings', array() ), generate_get_defaults() ); if ( 'enable' !== $generate_settings['nav_search'] ) { return; } echo apply_filters( 'generate_navigation_search_output', ''); } endif; add_action( 'pre_get_posts', function( $q ) { if( $title = $q->get( '_meta_or_title' ) ) { add_filter( 'get_meta_sql', function( $sql ) use ( $title ) { global $wpdb; // Only run once: static $nr = 0; if( 0 != $nr++ ) return $sql; // Modified WHERE $sql['where'] = sprintf( " AND ( %s OR %s ) ", $wpdb->prepare( "{$wpdb->posts}.post_title like '%%%s%%'", $title), mb_substr( $sql['where'], 5, mb_strlen( $sql['where'] ) ) ); return $sql; }); } });