Conditions | 3 |
Paths | 3 |
Total Lines | 33 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
26 | protected function actions_section(){ |
||
27 | $html = ''; |
||
28 | |||
29 | // Loop through every post type available on the site |
||
30 | $post_types = get_post_types( array( 'public' => true ), 'objects' ); |
||
31 | |||
32 | foreach ( $post_types as $post_type ) : |
||
33 | |||
34 | $skipped_cpts = array( |
||
35 | 'attachment' |
||
36 | ); |
||
37 | |||
38 | // Skip banned cpts |
||
39 | if ( in_array( $post_type->name, $skipped_cpts ) ){ |
||
40 | continue; |
||
41 | } |
||
42 | |||
43 | $html .= "<div class='test-data-cpt'>"; |
||
44 | |||
45 | $html .= "<h3>"; |
||
46 | |||
47 | $html .= "<span class='label'>" . $post_type->labels->name . "</span>"; |
||
48 | $html .= $this->build_button( 'create', $post_type->name, __( 'Create Test Data', 'otm-test-content' ) ); |
||
49 | $html .= $this->build_button( 'delete', $post_type->name, __( 'Delete Test Data', 'otm-test-content' ) ); |
||
50 | |||
51 | $html .= "</h3>"; |
||
52 | |||
53 | $html .= "</div>"; |
||
54 | |||
55 | endforeach; |
||
56 | |||
57 | return $html; |
||
58 | } |
||
59 | |||
61 |