mirror of
https://github.com/cupcakearmy/liquet.git
synced 2024-12-22 16:16:25 +00:00
automatic settings generation
This commit is contained in:
parent
a290ab34e2
commit
b3f9b9e067
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
include_once( 'logos.php' );
|
||||||
|
|
||||||
add_theme_support( 'align-wide' );
|
add_theme_support( 'align-wide' );
|
||||||
add_theme_support( 'title-tag' );
|
add_theme_support( 'title-tag' );
|
||||||
|
|
||||||
@ -8,5 +10,42 @@ add_action( 'wp_enqueue_scripts', function () {
|
|||||||
wp_enqueue_style( 'liquet', get_template_directory_uri() . '/style.css' );
|
wp_enqueue_style( 'liquet', get_template_directory_uri() . '/style.css' );
|
||||||
wp_enqueue_style( 'liquet-home', get_template_directory_uri() . '/css/home.css' );
|
wp_enqueue_style( 'liquet-home', get_template_directory_uri() . '/css/home.css' );
|
||||||
wp_enqueue_style( 'liquet-singular', get_template_directory_uri() . '/css/singular.css' );
|
wp_enqueue_style( 'liquet-singular', get_template_directory_uri() . '/css/singular.css' );
|
||||||
|
wp_enqueue_style( 'liquet-logos', get_template_directory_uri() . '/css/logos.css' );
|
||||||
wp_enqueue_style( 'fonts', get_template_directory_uri() . '/vendor/fonts/import.css' );
|
wp_enqueue_style( 'fonts', get_template_directory_uri() . '/vendor/fonts/import.css' );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
||||||
|
add_action( 'admin_init', function () {
|
||||||
|
add_settings_section( 'section', 'All Settings', null, 'theme-options' );
|
||||||
|
|
||||||
|
global $links;
|
||||||
|
foreach ( $links as $link ) {
|
||||||
|
|
||||||
|
$id = $link . '_url';
|
||||||
|
add_settings_field( $id, ucfirst( $link ) . ' Url', function () use ( $id ) { ?>
|
||||||
|
<input type="text" name="<?= $id ?>" id="<?= $id ?>" value="<?= get_option( $id ); ?>"/>
|
||||||
|
<?php }, 'theme-options', 'section' );
|
||||||
|
|
||||||
|
register_setting( 'section', $id );
|
||||||
|
}
|
||||||
|
|
||||||
|
} );
|
||||||
|
|
||||||
|
function theme_settings_page() { ?>
|
||||||
|
<div class='wrap'>
|
||||||
|
<h1>Theme Panel</h1>
|
||||||
|
<form method="post" action="options.php">
|
||||||
|
<?php
|
||||||
|
settings_fields( 'section' );
|
||||||
|
do_settings_sections( 'theme-options' );
|
||||||
|
submit_button();
|
||||||
|
?>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<?php }
|
||||||
|
|
||||||
|
function add_theme_menu_item() {
|
||||||
|
add_menu_page( 'Theme Panel', 'Theme Panel', 'manage_options', 'theme-panel', 'theme_settings_page', null, 99 );
|
||||||
|
}
|
||||||
|
|
||||||
|
add_action( 'admin_menu', 'add_theme_menu_item' );
|
Loading…
Reference in New Issue
Block a user