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' );