-
Notifications
You must be signed in to change notification settings - Fork 2
/
front-page-manager-functions.php
50 lines (41 loc) · 1.51 KB
/
front-page-manager-functions.php
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
<?php
/**
* Front Page Manager
*
* @package FrontPageManager
* @author Brad Potter
* @license GPL-2.0+
* @link http://www.bradpotter.com/plugins/front-page-manager
* @copyright 2014, Brad Potter
*/
/**
* Add metabox for Front Page Manager
*
* @since 1.0.0
*/
function front_page_manager_metaboxes( $pagehook ) {
add_meta_box( 'front-page-manager', __( 'Front Page Manager', 'front-page-manager' ), 'front_page_manager_content', $pagehook, 'main', 'high' );
}
add_action( 'genesis_theme_settings_metaboxes', 'front_page_manager_metaboxes', 10, 1 );
/**
* Add content for Front Page Manager metabox
*
* @since 1.0.0
*/
function front_page_manager_content() {
// set the default selection (if empty)
$frontpageselect = genesis_get_option('front_page_select') ? genesis_get_option('front_page_select') : 'front-page.php';
?>
<p>
<select name="<?php echo esc_attr( GENESIS_SETTINGS_FIELD . '[front_page_select]' ); ?>">
<?php
foreach ( glob( get_stylesheet_directory() . "/front-page*.php") as $file ) {
$file = str_replace( get_stylesheet_directory() . '/', '', $file );
?>
<option value="<?php echo esc_attr( $file ); ?>"<?php selected($file, $frontpageselect); ?>><?php echo esc_html( $file ); ?></option>
<?php } ?>
</select>
</p>
<p><span class="description">Select your desired Front Page from the drop down list and save settings.</span></p>
<?php
}