PluginProbe
Assistant – Every Day Productivity Apps / 1.3.5
Assistant – Every Day Productivity Apps v1.3.5
1.5.5 trunk 0.1.0 0.2.0 0.2.1 0.2.2 0.3.0 0.3.1 0.4 0.4.1 0.4.2 0.5.0 0.5.1 0.6.0 0.7.0 0.7.0.2 0.7.0.3 0.7.0.4 0.7.0.5 0.7.0.6 0.7.0.7 0.7.0.8 0.7.0.9 0.7.1 1.0 All 71 releases
← All changes | backend/src/Data/Repository/PostsRepository.php +27 -7 0.41.3.5 View file →
@@ -124,15 +124,26 @@
124 124 * @return array
125 125 */
126 126 public function get_types() {
127 127 $data = [];
128 - $types = get_post_types(
129 - [
130 - 'public' => true,
131 - ],
132 - 'objects'
133 - );
128 + $types = get_post_types( [], 'objects' );
134 129
130 + // Types with show_ui false that we want to show
131 + $known = [
132 + 'wp_template',
133 + 'wp_template_part',
134 + ];
135 +
136 + // Types to never show
137 + $ignore = [
138 + 'attachment',
139 + 'wp_navigation',
140 + 'vcv_tutorials',
141 + 'elementor_snippet',
142 + 'elementor_font',
143 + 'elementor_icons',
144 + ];
145 +
135 146 foreach ( $types as $slug => $type ) {
136 147 if ( ! isset( $type->cap->edit_others_posts ) ) {
137 148 continue;
138 149 }
@@ -138,16 +149,20 @@
138 149 }
139 150 if ( ! current_user_can( $type->cap->edit_others_posts ) ) {
140 151 continue;
141 152 }
142 - if ( 'attachment' === $slug ) {
153 + if ( ! $type->show_ui && ! in_array( $slug, $known ) ) {
143 154 continue;
144 155 }
156 + if ( in_array( $slug, $ignore ) ) {
157 + continue;
158 + }
145 159 if ( ! function_exists( 'get_page_templates' ) ) {
146 160 require_once ABSPATH . 'wp-admin/includes/theme.php';
147 161 }
148 162
149 163 $data[ $slug ] = [
164 + 'canView' => $type->public || $type->publicly_queryable,
150 165 'canExport' => $type->can_export,
151 166 'hasArchive' => $type->has_archive,
152 167 'isHierarchical' => $type->hierarchical,
153 168 'builtin' => $type->_builtin,
@@ -167,8 +182,13 @@
167 182 'editItem' => esc_html( $type->labels->edit_item ),
168 183 'viewItem' => esc_html( $type->labels->view_item ),
169 184 ],
170 185 ];
186 +
187 + if ( 'wp_template' === $slug || 'wp_template_part' === $slug ) {
188 + $data[ $slug ]['labels']['singular'] = sprintf( esc_html_x( 'Block %s', 'Singular type name.', 'fl-assistant' ), $type->labels->singular_name );
189 + $data[ $slug ]['labels']['plural'] = sprintf( esc_html_x( 'Block %s', 'Plural type name.', 'fl-assistant' ), $type->labels->name );
190 + }
171 191
172 192 $taxonomies = get_object_taxonomies( $slug, 'objects' );
173 193
174 194 foreach ( $taxonomies as $tax_slug => $tax ) {