windhamdavid 9 months ago
commit
cf214ea802
3 changed files with 83 additions and 0 deletions
  1. 6 0
      .gitignore
  2. 63 0
      functions.php
  3. 14 0
      style.css

+ 6 - 0
.gitignore

@@ -0,0 +1,6 @@
+.DS_Store
+Thumbs.db
+screenshot.png
+
+/node_modules
+npm-debug.log

+ 63 - 0
functions.php

@@ -0,0 +1,63 @@
+<?php
+
+//set builder mode to debug
+//add_action('avia_builder_mode', "builder_set_debug");
+//function builder_set_debug()
+//{
+//	return "debug";
+//}
+
+add_action('after_setup_theme', 'remove_portfolio');
+function remove_portfolio() {
+remove_action('init', 'portfolio_register');
+}
+
+
+/******************* START NOTIFICATIONS *********************/
+add_action( 'admin_menu', 'srh_notice_add_admin_menu' );
+function srh_notice_add_admin_menu() { 
+	add_options_page( 'SRH Notifications', 'SRH Notifications', 'manage_options', 'srh_notice', 'srh_notice_options_page' );
+}
+add_action( 'admin_init', 'srh_notice_settings_init' );
+function srh_notice_settings_init() { 
+	register_setting('srh_notices', 'srh_notice_settings');
+	register_setting('srh_notices', 'srh_notice_message');
+	add_settings_section('srh_notice_active_section', 'Notifications', 'srh_notice_settings_section_callback', 'srh_notices');
+	add_settings_field('srh_notice_select_field_0', 'Notifications Active', 'srh_notice_select_field_0_render', 'srh_notices', 'srh_notice_active_section' );
+	add_settings_field('srh_notice_message', 'Notification Message', 'srh_notice_message_render', 'srh_notices', 'srh_notice_active_section');
+}
+function srh_notice_settings_section_callback(  ) { 
+	echo __( 'This form sets a Notification Message for All Pages', 'wordpress' );
+}
+function srh_notice_select_field_0_render() { 
+	$options = get_option( 'srh_notice_settings' ); ?>
+	<select name='srh_notice_settings[srh_notice_select_field_0]'>
+		<option value='1' <?php selected( $options['srh_notice_select_field_0'], 1 ); ?>>Yes</option>
+		<option value='2' <?php selected( $options['srh_notice_select_field_0'], 2 ); ?>>No</option>
+	</select>	
+<?php }
+function srh_notice_message_render() {
+	$srh_notice_message = get_option( 'srh_notice_message' );
+	echo wp_editor( $srh_notice_message, 'srh_notice_message', array('textarea_name' => 'srh_notice_message')  );
+}
+function srh_notice_options_page() { ?>
+	<div class="wrap">
+		<h1>Self Regional (.org)</h1>
+		<form action='options.php' method='post'>	
+			<?php 
+				settings_fields('srh_notices');
+				do_settings_sections('srh_notices');
+				submit_button(); 
+			?>
+		</form>
+	</div>
+<?php }
+function srh_notice_display_message() {
+	echo get_option('srh_notice_message');
+}
+$srh_status = get_option('srh_notice_settings');
+if( $srh_status['srh_notice_select_field_0'] == '1' ) { 
+	add_action('ava_after_main_container', 'srh_notice_display_message');
+}
+/******************* END NOTIFICATIONS *********************/
+

+ 14 - 0
style.css

@@ -0,0 +1,14 @@
+/*
+ Theme Name:   Self Regional Theme
+ Author:       David Windham
+ Author URI:   https://davidawindham.com
+ Template:     enfold
+ Version:      2.0.0
+*/
+
+
+/* @import url("../enfold/style.css"); */
+
+
+/* =Theme customization starts here
+-------------------------------------------------------------- */