| @@ -2,10 +2,29 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace Templately\Admin; |
| 4 | 4 | |
| 5 | 5 | use Templately\Utils\Base; |
| 6 | +use Templately\Utils\Helper; | |
| 6 | 7 | |
| 7 | 8 | class Settings extends Base { |
| 8 | - public function display() { | |
| 9 | - echo 'Hello World - Settings'; | |
| 9 | + | |
| 10 | + public function __construct() { | |
| 11 | + add_action('admin_menu', [$this, 'admin_menu']); | |
| 12 | + add_action('wp_head', [$this, 'add_custom_css']); | |
| 10 | 13 | } |
| 11 | -} | |
| 14 | + | |
| 15 | + public function admin_menu() { | |
| 16 | + add_submenu_page( 'templately', 'Settings', 'Settings', 'delete_posts', 'templately_settings', [$this, 'display_settings'], '58.7' ); | |
| 17 | + } | |
| 18 | + | |
| 19 | + | |
| 20 | + public function display_settings() { | |
| 21 | + Helper::views( 'settings' ); | |
| 22 | + } | |
| 23 | + | |
| 24 | + public function add_custom_css() { | |
| 25 | + $custom_css = get_option('templately_custom_css'); | |
| 26 | + if($custom_css){ | |
| 27 | + echo "\n<style id='templately-custom-css'>\n".$custom_css."\n</style>\n"; | |
| 28 | + } | |
| 29 | + } | |
| 30 | +} | |