-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
260 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...ustomizer/design/sections/custom-post-archive/controls/entries-display-item-date-icon.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/** | ||
* @package snow-monkey | ||
* @author inc2734 | ||
* @license GPL-2.0+ | ||
* @version 27.2.0 | ||
*/ | ||
|
||
use Inc2734\WP_Customizer_Framework\Framework; | ||
use Framework\Helper; | ||
|
||
$custom_post_types = Helper::get_custom_post_types(); | ||
|
||
foreach ( $custom_post_types as $custom_post_type ) { | ||
Framework::control( | ||
'checkbox', | ||
$custom_post_type . '-entries-display-item-date-icon', | ||
array( | ||
'label' => __( 'Display the modified date for each item in the entries', 'snow-monkey' ), | ||
'priority' => 210, | ||
'default' => false, | ||
'active_callback' => function () use ( $custom_post_type ) { | ||
$archive_view = get_theme_mod( $custom_post_type . '-archive-view' ); | ||
if ( 'post' === $archive_view ) { | ||
return false; | ||
} | ||
|
||
$display_published_date = get_theme_mod( $custom_post_type . '-entries-display-item-published' ); | ||
$display_modified_date = get_theme_mod( $custom_post_type . '-entries-display-item-modified' ); | ||
|
||
return $display_published_date || $display_modified_date; | ||
}, | ||
'sanitize_callback' => function ( $value ) use ( $custom_post_type ) { | ||
$archive_view = get_theme_mod( $custom_post_type . '-archive-view' ); | ||
if ( 'post' === $archive_view ) { | ||
return ''; | ||
} | ||
|
||
return $value; | ||
}, | ||
) | ||
); | ||
} | ||
|
||
if ( ! is_customize_preview() ) { | ||
return; | ||
} | ||
|
||
$panel = Framework::get_panel( 'design' ); | ||
|
||
foreach ( $custom_post_types as $custom_post_type ) { | ||
$section = Framework::get_section( 'design-' . $custom_post_type . '-archive' ); | ||
$control = Framework::get_control( $custom_post_type . '-entries-display-item-date-icon' ); | ||
$control->join( $section )->join( $panel ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...customizer/design/sections/custom-post-archive/controls/entries-display-item-modified.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
/** | ||
* @package snow-monkey | ||
* @author inc2734 | ||
* @license GPL-2.0+ | ||
* @version 27.2.0 | ||
*/ | ||
|
||
use Inc2734\WP_Customizer_Framework\Framework; | ||
use Framework\Helper; | ||
|
||
$custom_post_types = Helper::get_custom_post_types(); | ||
|
||
foreach ( $custom_post_types as $custom_post_type ) { | ||
Framework::control( | ||
'checkbox', | ||
$custom_post_type . '-entries-display-item-modified', | ||
array( | ||
'label' => __( 'Display the modified date for each item in the entries', 'snow-monkey' ), | ||
'priority' => 200, | ||
'default' => false, | ||
'active_callback' => function () use ( $custom_post_type ) { | ||
$archive_view = get_theme_mod( $custom_post_type . '-archive-view' ); | ||
if ( 'post' === $archive_view ) { | ||
return false; | ||
} | ||
|
||
return true; | ||
}, | ||
'sanitize_callback' => function ( $value ) use ( $custom_post_type ) { | ||
$archive_view = get_theme_mod( $custom_post_type . '-archive-view' ); | ||
if ( 'post' === $archive_view ) { | ||
return ''; | ||
} | ||
|
||
return $value; | ||
}, | ||
) | ||
); | ||
} | ||
|
||
if ( ! is_customize_preview() ) { | ||
return; | ||
} | ||
|
||
$panel = Framework::get_panel( 'design' ); | ||
|
||
foreach ( $custom_post_types as $custom_post_type ) { | ||
$section = Framework::get_section( 'design-' . $custom_post_type . '-archive' ); | ||
$control = Framework::get_control( $custom_post_type . '-entries-display-item-modified' ); | ||
$control->join( $section )->join( $panel ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
app/customizer/design/sections/entries/controls/entries-display-item-date-icon.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
/** | ||
* @package snow-monkey | ||
* @author inc2734 | ||
* @license GPL-2.0+ | ||
* @version 27.2.0 | ||
*/ | ||
|
||
use Inc2734\WP_Customizer_Framework\Framework; | ||
|
||
Framework::control( | ||
'checkbox', | ||
'post-entries-display-item-date-icon', | ||
array( | ||
'label' => __( 'Display the icons for each item in the entries publish date / modified date', 'snow-monkey' ), | ||
'priority' => 150, | ||
'default' => false, | ||
'active_callback' => function () { | ||
$display_published_date = get_theme_mod( 'post-entries-display-item-published' ); | ||
$display_modified_date = get_theme_mod( 'post-entries-display-item-modified' ); | ||
|
||
return $display_published_date || $display_modified_date; | ||
}, | ||
) | ||
); | ||
|
||
if ( ! is_customize_preview() ) { | ||
return; | ||
} | ||
|
||
$panel = Framework::get_panel( 'design' ); | ||
$section = Framework::get_section( 'entries' ); | ||
$control = Framework::get_control( 'post-entries-display-item-date-icon' ); | ||
$control->join( $section )->join( $panel ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
app/customizer/design/sections/entries/controls/entries-display-item-modified.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
/** | ||
* @package snow-monkey | ||
* @author inc2734 | ||
* @license GPL-2.0+ | ||
* @version 27.2.0 | ||
*/ | ||
|
||
use Inc2734\WP_Customizer_Framework\Framework; | ||
|
||
Framework::control( | ||
'checkbox', | ||
'post-entries-display-item-modified', | ||
array( | ||
'label' => __( 'Display the modified date for each item in the entries', 'snow-monkey' ), | ||
'priority' => 140, | ||
'default' => false, | ||
) | ||
); | ||
|
||
if ( ! is_customize_preview() ) { | ||
return; | ||
} | ||
|
||
$panel = Framework::get_panel( 'design' ); | ||
$section = Framework::get_section( 'entries' ); | ||
$control = Framework::get_control( 'post-entries-display-item-modified' ); | ||
$control->join( $section )->join( $panel ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.