In file function.php:
function mk_section_theme_custom() {
add_options_page(
'Theme Custom', // Titolo pagina
'Theme Custom Content', // Nome nel menu
'manage_options', // Permesso richiesto
'mk-theme-custom', // Slug
'mk_section_thema_html'// Funzione che stampa la pagina
);
}
add_action('admin_menu', 'mk_section_theme_custom');
function mk_section_thema_html (){
$mkbg = get_option( 'mkbg', get_template_directory_uri().'/assets/img/bg.jpg' );
break_php
<form method="post" action="">
<p>
<label>Background Immagine</label>
<br>
<textarea rows="5" style="width: 400px" name="mkbg"><?=$mkbg?></textarea>
</p>
<p><input type="submit" value="Salva" name="mksalva"></p>
</form>
reopen_php
}
if(isset($_POST['mksalva'])){
if(!empty($_POST['mkbg'])) {
update_option( 'mkbg', $_POST['mkbg']);
}
}