function exclude_premade_layouts_library($query) { global $pagenow; $current_post_type = get_query_var('post_type'); if (is_admin() && 'edit.php' === $pagenow && $current_post_type && 'et_pb_layout' === $current_post_type) { $meta_query = array(array('key' => '_et_pb_predefined_layout', 'value' => 'on', 'compare' => 'NOT EXISTS')); $used_built_for_post_types = et_pb_get_used_built_for_post_types(); if (isset($_GET['built_for']) && count($used_built_for_post_types) > 1) { $built_for_post_type = sanitize_text_field($_GET['built_for']); // get array of all standard post types if built_for is one of them $built_for_post_type_processed = in_array($built_for_post_type, et_pb_get_standard_post_types()) ? et_pb_get_standard_post_types() : $built_for_post_type; if (in_array($built_for_post_type, $used_built_for_post_types)) { $meta_query[] = array('key' => '_et_pb_built_for_post_type', 'value' => $built_for_post_type_processed, 'compare' => 'IN'); } } $query->set('meta_query', $meta_query); } return $query; }
function et_pb_built_for_post_type_display($post_type) { $standard_post_types = et_pb_get_standard_post_types(); if (in_array($post_type, $standard_post_types)) { return esc_html__('Standard', 'et_builder'); } return $post_type; }