-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpost-types.php
More file actions
52 lines (47 loc) · 1.7 KB
/
post-types.php
File metadata and controls
52 lines (47 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/**
* Settings popover.
*
* @package Progress_Planner
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$prpl_saved_settings = \progress_planner()->get_activities__content_helpers()->get_post_types_names();
$prpl_post_types = \progress_planner()->get_activities__content_helpers()->get_public_post_types();
// Early exit if there are no public post types.
if ( empty( $prpl_post_types ) ) {
return;
}
// We use it in order to change grid layout when there are more than 5 valuable post types.
$prpl_data_attributes = 5 < count( $prpl_post_types ) ? 'data-has-many-valuable-post-types' : '';
?>
<div class="prpl-column prpl-column-post-types" <?php echo \esc_attr( $prpl_data_attributes ); ?>>
<div class="prpl-widget-wrapper">
<h2 class="prpl-settings-section-title">
<span class="icon">
<?php \progress_planner()->the_asset( 'images/icon_copywriting.svg' ); ?>
</span>
<span>
<?php esc_html_e( 'Valuable post types', 'progress-planner' ); ?>
</span>
</h2>
<p>
<?php esc_html_e( 'You\'re in control of what counts as valuable content. We\'ll track and reward activity only for the post types you select here.', 'progress-planner' ); ?>
</p>
<div id="prpl-post-types-include-wrapper">
<?php foreach ( $prpl_post_types as $prpl_post_type ) : ?>
<label>
<input
type="checkbox"
name="prpl-post-types-include[]"
value="<?php echo \esc_attr( $prpl_post_type ); ?>"
<?php checked( \in_array( $prpl_post_type, $prpl_saved_settings, true ) ); ?>
/>
<?php echo \esc_html( \get_post_type_object( $prpl_post_type )->labels->name ); // @phpstan-ignore-line property.nonObject ?>
</label>
<?php endforeach; ?>
</div>
</div>
</div>