| @@ -64,9 +64,9 @@ | ||
| 64 | 64 | * Add content-control class |
| 65 | 65 | * |
| 66 | 66 | * @param array<string,string> $classes Array of QM classes. |
| 67 | 67 | * |
| 68 | - * @return array<string,string> | |
| 68 | + * @return array<int<0,max>|string,string> | |
| 69 | 69 | */ |
| 70 | 70 | public function admin_class( $classes ) { |
| 71 | 71 | $classes[] = 'qm-content-control'; |
| 72 | 72 | |
| @@ -208,17 +208,28 @@ | ||
| 208 | 208 | foreach ( $posts as $post_id => $post_data ) { |
| 209 | 209 | if ( 'main' === $post_id ) { |
| 210 | 210 | continue; |
| 211 | 211 | } |
| 212 | - $post = get_post( $post_id ); | |
| 213 | 212 | |
| 213 | + if ( strpos( $post_data['context'], 'terms' ) !== false ) { | |
| 214 | + $term = get_term( $post_id ); | |
| 215 | + $name = $term->name; | |
| 216 | + $type = 'TAX: ' . $term->taxonomy; | |
| 217 | + } elseif ( strpos( $post_data['context'], 'posts' ) !== false ) { | |
| 218 | + $post = get_post( $post_id ); | |
| 219 | + $name = $post->post_title; | |
| 220 | + $type = 'PT: ' . $post->post_type; | |
| 221 | + } else { | |
| 222 | + continue; | |
| 223 | + } | |
| 224 | + | |
| 214 | 225 | $user_can_view = $post_data['user_can_view'] ? 'Yes' : 'No'; |
| 215 | 226 | $restrictions = $post_data['restrictions'] ? $post_data['restrictions'] : []; |
| 216 | 227 | |
| 217 | 228 | echo '<tr>'; |
| 218 | 229 | echo '<td>' . esc_html( $post_id ) . '</td>'; |
| 219 | - echo '<td>' . esc_html( $post->post_title ) . '</td>'; | |
| 220 | - echo '<td>' . esc_html( $post->post_type ) . '</td>'; | |
| 230 | + echo '<td>' . esc_html( $name ) . '</td>'; | |
| 231 | + echo '<td>' . esc_html( $type ) . '</td>'; | |
| 221 | 232 | echo '<td>' . esc_html( $post_data['context'] ) . '</td>'; |
| 222 | 233 | echo '<td>' . esc_html( $user_can_view ) . '</td>'; |
| 223 | 234 | |
| 224 | 235 | $restrictions_html = []; |