PluginProbe
Assistant – Every Day Productivity Apps / 1.4.8
Assistant – Every Day Productivity Apps v1.4.8
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 +28 -8 1.01.4.8 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 - 'show_ui' => 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,
@@ -168,8 +183,13 @@
168 183 'viewItem' => esc_html( $type->labels->view_item ),
169 184 ],
170 185 ];
171 186
187 + if ( 'wp_template' === $slug || 'wp_template_part' === $slug ) {
188 + $data[ $slug ]['labels']['singular'] = sprintf( esc_html_x( 'Block %s', 'Singular type name.', 'assistant' ), $type->labels->singular_name );
189 + $data[ $slug ]['labels']['plural'] = sprintf( esc_html_x( 'Block %s', 'Plural type name.', 'assistant' ), $type->labels->name );
190 + }
191 +
172 192 $taxonomies = get_object_taxonomies( $slug, 'objects' );
173 193
174 194 foreach ( $taxonomies as $tax_slug => $tax ) {
175 195 if ( ! $tax->public || ! $tax->show_ui ) {
@@ -200,9 +220,9 @@
200 220 'isHierarchical' => $taxonomy->hierarchical,
201 221 'labels' => [
202 222 'singular' => esc_html( $taxonomy->labels->singular_name ),
203 223 'plural' => esc_html( $taxonomy->labels->name ),
204 - 'newItem' => sprintf( esc_html_x( 'New %s', 'Singular term name.', 'fl-assistant' ), $taxonomy->labels->singular_name ),
224 + 'newItem' => sprintf( esc_html_x( 'New %s', 'Singular term name.', 'assistant' ), $taxonomy->labels->singular_name ),
205 225 'addNewItem' => esc_html( $taxonomy->labels->add_new_item ),
206 226 'editItem' => esc_html( $taxonomy->labels->edit_item ),
207 227 ],
208 228 ];