8 changed files with 687 additions and 465 deletions
File diff suppressed because it is too large
@ -0,0 +1,35 @@ |
|||||
|
<?php |
||||
|
|
||||
|
function it_render_template($template, $args) |
||||
|
{ |
||||
|
extract($args); |
||||
|
include(__DIR__ . '/templates/' . $template); |
||||
|
} |
||||
|
|
||||
|
add_action('admin_init', function () { |
||||
|
register_setting('it-slider', 'it-slider-options'); |
||||
|
add_settings_section('it-slider-section', 'Stellen Sie hier Ihren Immobilien-Slider ein.', fn () => '', 'it-slider'); |
||||
|
|
||||
|
add_settings_field('it-slider-field-color', 'Primäre Farbe', function ($args) { |
||||
|
$options = get_option('it-slider-options'); |
||||
|
it_render_template('color-input.htm', ['value' => $options[$args['key']], 'name' => $args['key']]); |
||||
|
}, 'it-slider', 'it-slider-section', ['key' => 'it-slider-color']); |
||||
|
}); |
||||
|
|
||||
|
add_action('admin_menu', function () { |
||||
|
add_submenu_page( |
||||
|
'options-general.php', |
||||
|
'Immotooler Slider', |
||||
|
'Immotooler Slider', |
||||
|
'manage_options', |
||||
|
'immotooler-slider', |
||||
|
function () { |
||||
|
if (!current_user_can('manage_options')) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
settings_errors('wporg_messages'); |
||||
|
echo it_render_template('settings-body.htm', []); |
||||
|
} |
||||
|
); |
||||
|
}); |
||||
@ -0,0 +1 @@ |
|||||
|
<input type="color" value="<?php echo esc_attr($value); ?>" name="it-slider-options[<?php echo esc_attr($name); ?>]"> |
||||
@ -0,0 +1,10 @@ |
|||||
|
<div class="wrap"> |
||||
|
<h1><?php echo esc_html(get_admin_page_title()); ?></h1> |
||||
|
<form action="options.php" method="post"> |
||||
|
<?php |
||||
|
settings_fields('it-slider'); |
||||
|
do_settings_sections('it-slider'); |
||||
|
submit_button('Speichern'); |
||||
|
?> |
||||
|
</form> |
||||
|
</div> |
||||
@ -0,0 +1,3 @@ |
|||||
|
<p id="<?php echo esc_attr($args['id']); ?>"> |
||||
|
Follow the white rabbit. |
||||
|
</p> |
||||
Loading…
Reference in new issue