|
|
@@ -538,4 +538,78 @@ Testimonials
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+/* ------------------ */
|
|
|
+/* theme options page */
|
|
|
+/* ------------------ */
|
|
|
+/* https://blog.kulturbanause.de/2011/11/theme-options-page-fur-wordpress-erstellen/ */
|
|
|
+
|
|
|
+add_action( 'admin_init', 'theme_options_init' );
|
|
|
+add_action( 'admin_menu', 'theme_options_add_page' );
|
|
|
+
|
|
|
+// Einstellungen registrieren (http://codex.wordpress.org/Function_Reference/register_setting)
|
|
|
+function theme_options_init(){
|
|
|
+ register_setting( 'rl_options', 'rl_theme_options', 'rl_validate_options' );
|
|
|
+}
|
|
|
+
|
|
|
+// Seite in der Dashboard-Navigation erstellen
|
|
|
+function theme_options_add_page() {
|
|
|
+ add_theme_page('Optionen', 'Optionen', 'edit_theme_options', 'theme-optionen', 'rl_theme_options_page' ); // Seitentitel, Titel in der Navi, Berechtigung zum Editieren (http://codex.wordpress.org/Roles_and_Capabilities) , Slug, Funktion
|
|
|
+}
|
|
|
+
|
|
|
+// Optionen-Seite erstellen
|
|
|
+function rl_theme_options_page() {
|
|
|
+global $select_options, $radio_options;
|
|
|
+if ( ! isset( $_REQUEST['settings-updated'] ) )
|
|
|
+ $_REQUEST['settings-updated'] = false; ?>
|
|
|
+
|
|
|
+<div class="wrap">
|
|
|
+<?php screen_icon(); ?><h2>Theme-Optionen für <?php bloginfo('name'); ?></h2>
|
|
|
+
|
|
|
+<?php if ( false !== $_REQUEST['settings-updated'] ) : ?>
|
|
|
+<div class="updated fade">
|
|
|
+ <p><strong>Einstellungen gespeichert!</strong></p>
|
|
|
+</div>
|
|
|
+<?php endif; ?>
|
|
|
+
|
|
|
+ <form method="post" action="options.php">
|
|
|
+ <?php settings_fields( 'rl_options' ); ?>
|
|
|
+ <?php $options = get_option( 'rl_theme_options' ); ?>
|
|
|
+
|
|
|
+ <table class="form-table">
|
|
|
+
|
|
|
+ <tr valign="top">
|
|
|
+ <th scope="row">Google Analytics</th>
|
|
|
+ <td><textarea id="rl_theme_options[kontakt]" class="large-text" cols="50" rows="10" name="rl_theme_options[kontakt]"><?php echo esc_textarea( $options['kontakt'] ); ?></textarea></td>
|
|
|
+ </tr>
|
|
|
+ </table>
|
|
|
+
|
|
|
+ <!-- submit -->
|
|
|
+ <p class="submit"><input type="submit" class="button-primary" value="Einstellungen speichern" /></p>
|
|
|
+ </form>
|
|
|
+</div>
|
|
|
+<?php }
|
|
|
+
|
|
|
+// Strip HTML-Code:
|
|
|
+// Hier kann definiert werden, ob HTML-Code in einem Eingabefeld
|
|
|
+// automatisch entfernt werden soll. Soll beispielsweise im
|
|
|
+// Copyright-Feld KEIN HTML-Code erlaubt werden, kommentiert die Zeile
|
|
|
+// unten wieder ein. http://codex.wordpress.org/Function_Reference/wp_filter_nohtml_kses
|
|
|
+function rl_validate_options( $input ) {
|
|
|
+ // $input['copyright'] = wp_filter_nohtml_kses( $input['copyright'] );
|
|
|
+ return $input;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/* DON'T DELETE THIS CLOSING TAG */ ?>
|