Archived
Merge branch 'master' of github.com:neuf/studio11-theme
This commit is contained in:
commit
ac4b2a22a2
2 files changed
+60
-2
No files matched your search
+10
-2
@@ -12,7 +12,6 @@ get_header(); ?>
|
||||
{
|
||||
margin-bottom:50px;
|
||||
background-color:#f1ede7;
|
||||
background-color:rgba(18,178,89,0.8);
|
||||
padding:10px;
|
||||
}
|
||||
|
||||
@@ -20,8 +19,17 @@ get_header(); ?>
|
||||
<div id="container">
|
||||
<div id="content" role="main">
|
||||
<?php
|
||||
$items = wp_get_nav_menu_items('3');
|
||||
|
||||
$menu_id = get_option('front_menu_id');
|
||||
if($menu_id)
|
||||
{
|
||||
$items = wp_get_nav_menu_items($menu_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "No frontpage menu configured";
|
||||
$items = array();
|
||||
}
|
||||
foreach($items as $item)
|
||||
{
|
||||
wp_reset_postdata();
|
||||
|
||||
@@ -182,3 +182,53 @@ function menu_links($items, $args)
|
||||
}
|
||||
|
||||
add_filter('wp_nav_menu_objects', 'menu_links');
|
||||
|
||||
|
||||
|
||||
// create custom plugin settings menu
|
||||
add_action('admin_menu', 'studio_create_menu');
|
||||
|
||||
|
||||
|
||||
function studio_create_menu() {
|
||||
|
||||
//create new top-level menu
|
||||
add_menu_page('Studio theme settings', 'Studio theme settings', 'administrator', __FILE__, 'studio_settings_page',plugins_url('/images/icon.png', __FILE__));
|
||||
|
||||
//call register settings function
|
||||
add_action( 'admin_init', 'register_studio_settings' );
|
||||
}
|
||||
|
||||
|
||||
function register_studio_settings() {
|
||||
//register our settings
|
||||
register_setting( 'studio-settings', 'front_menu_id' );
|
||||
}
|
||||
|
||||
function studio_settings_page() {
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h2>Studio theme</h2>
|
||||
|
||||
<form method="post" action="options.php">
|
||||
<?php
|
||||
settings_fields( 'studio-settings' ); ?>
|
||||
<?php //do_settings( 'baw-settings-group' ); ?>
|
||||
|
||||
<?php
|
||||
|
||||
$menus = wp_get_nav_menus( );
|
||||
|
||||
?>
|
||||
<select name="front_menu_id">
|
||||
|
||||
<?php foreach($menus as $menu): ?>
|
||||
<option value="<?php echo $menu->term_id ?>" <?php if($menu->term_id == get_option('front_menu_id')) echo ' selected="selected"'?> ><?php echo $menu->name ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<p class="submit">
|
||||
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<?php } ?>
|
||||
Reference in new issue
Block a user