$post_type, 'title' => $page_title, 'post_status' => 'all', 'numberposts' => 1, 'update_post_term_cache' => false, 'update_post_meta_cache' => false, 'orderby' => 'post_date ID', 'order' => 'ASC', ) ); if ( ! empty( $posts ) ) { $post = $posts[0]; } else { $post = null; } return $post; } /** * Fix skip link focus in IE11. * * This does not enqueue the script because it is tiny and because it is only for IE11, * thus it does not warrant having an entire dedicated blocking script being loaded. * * @link https://git.io/vWdr2 */ function blockst_skip_link_focus_fix() { // The following is minified via `terser --compress --mangle -- assets/js/skip-link-focus-fix.js`. ?> ID, '_menu_item_object_id', true ) == get_option( 'page_for_posts' ) ) { $classes = array_diff( $classes, array( 'current_page_parent' ) ); } return $classes; } } add_filter( 'nav_menu_css_class', 'blockst_custom_post_type_nav_classes', 10, 2 ); /** * Custom excerpt length */ function blockst_custom_excerpt_length( $length ) { if ( is_admin() ) { return; } $excerpt_length = get_theme_mod( 'blockst_settings_posts_excerpt_settings', 30 ); return $excerpt_length; } add_filter( 'excerpt_length', 'blockst_custom_excerpt_length' ); if ( ! function_exists( 'blockst_cpt_pagination_rewrite' ) ) { /** * Fix pagination on cpt archive pages * * @since 1.0.0 */ function blockst_cpt_pagination_rewrite() { $permalinks = get_option( 'blockst_permalinks' ); if ( ! $permalinks ) { return; } $projects_base = empty( $permalinks['projects_base'] ) ? 'projects' : $permalinks['projects_base']; add_rewrite_rule( $projects_base . '/page/?([0-9]{1,})/?$', 'index.php?pagename=' . $projects_base . '&paged=$matches[1]', 'top'); } add_action('init', 'blockst_cpt_pagination_rewrite'); } if ( ! function_exists( 'blockst_sidebar' ) ) { /** * Get sidebar * * @since 1.0.0 */ function blockst_sidebar( $sidebar = '' ) { if ( ! is_active_sidebar( $sidebar ) ) return; ?> id === "post" ) { $classes = 'blockst-' . blockst_layout_type( 'single_post' ); } // Add page layout class if( $screen->id === "page" ) { $classes = 'blockst-' . blockst_layout_type( 'page' ); } return $classes; } add_filter( 'admin_body_class', 'blockst_admin_body_classes' );