windhamdavid 8 months ago
parent
commit
9efd62e9bc
9 changed files with 314 additions and 32 deletions
  1. 6 0
      .vscode/settings.json
  2. 220 14
      functions.php
  3. 4 5
      parts/header.html
  4. 4 4
      patterns/footer.php
  5. 0 0
      style-editor.css
  6. 31 1
      style.css
  7. 1 1
      templates/index.html
  8. 41 0
      templates/single.html
  9. 7 7
      theme.json

+ 6 - 0
.vscode/settings.json

@@ -0,0 +1,6 @@
+{
+  "files.exclude": {
+    "**/node_modules": true
+  },
+  "cSpell.enabled": false
+}

+ 220 - 14
functions.php

@@ -10,19 +10,6 @@ function uhp24_styles() {
 }
 add_action( 'wp_enqueue_scripts', 'uhp24_styles' );
 
-/***********************************************************
-######################## Editor ############################
-************************************************************/
-
-add_action( 'enqueue_block_assets', 'uhp24_block_styles', 5 );
-function uhp24_block_styles(){
-	wp_enqueue_style('uhp24-css', get_stylesheet_directory_uri() . '/style.css');
-}
-
-add_filter( 'should_load_remote_block_patterns', 'uhp24_disable_remote_patterns' );
-function uhp24_disable_remote_patterns() {
-	return false;
-}
 
 /***********************************************************
 ###################### BrowserSync #########################
@@ -47,4 +34,223 @@ add_action('rest_after_insert_post', 'uhp24_browsersync_save', 10, 3);
 add_action('save_post', 'uhp24_browsersync_save', 10, 3);
 add_action('customize_save_after', 'uhp24_browsersync_save', 10, 3);
 add_action('wp_update_nav_menu', 'uhp24_browsersync_save', 10, 3);
-add_action('updated_option', 'uhp24_browsersync_save', 10, 3);
+add_action('updated_option', 'uhp24_browsersync_save', 10, 3);
+
+
+/***********************************************************
+######################### Admin ############################
+************************************************************/
+
+add_filter( 'show_admin_bar', '__return_false' );
+
+add_filter('admin_title', 'uhp24_admin_title', 10, 2);
+function uhp24_admin_title($admin_title, $title) {
+    return $title .' - '. get_bloginfo('name');
+}
+
+add_filter ('update_footer', 'uhp24_footer_ver', 999);
+function uhp24_footer_ver ($default) {
+	return ''. get_bloginfo( 'version' );
+}
+
+add_filter ('admin_footer_text', 'uhp24_footer_filter');
+function uhp24_footer_filter ($default) {
+  return '';
+}
+
+add_filter( 'admin_bar_menu', 'uhp24_replace_wordpress_howdy', 25 );
+function uhp24_replace_wordpress_howdy( $wp_admin_bar ) {
+  $account = $wp_admin_bar->get_node('my-account');
+  $newtext = str_replace( 'Howdy,', '', $account->title );
+  $wp_admin_bar->add_node( array(
+    'id' => 'my-account',
+    'title' => $newtext,
+  ));
+}
+/* for email */
+add_filter( 'gettext', 'uhp24_change_howdy_text', 10, 2 );
+function uhp24_change_howdy_text( $translation, $original ) {
+  if( 'Howdy, %1$s' == $original )
+    $translation = '%1$s';
+  return $translation;
+}
+
+add_action('admin_head', 'mytheme_remove_help_tabs');
+function mytheme_remove_help_tabs() {
+    $screen = get_current_screen();
+    $screen->remove_help_tabs();
+}
+
+add_action( 'admin_head-profile.php', 'uhp24_remove_admin_color' );
+function uhp24_remove_admin_color() {
+    remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );
+}
+
+add_action( 'admin_bar_menu', 'uhp24_remove_adminbar', 999 );
+function uhp24_remove_adminbar( $wp_admin_bar ) {
+	$wp_admin_bar->remove_node('wp-logo');
+  $wp_admin_bar->remove_node('updates');
+  $wp_admin_bar->remove_menu('comments');
+  $wp_admin_bar->remove_menu('customize');
+  $wp_admin_bar->remove_menu('new-content');
+	$wp_admin_bar->remove_menu('edit');
+	$wp_admin_bar->remove_menu('new-user');
+	$wp_admin_bar->remove_menu('new-post');
+	$wp_admin_bar->remove_menu('new-page');
+	$wp_admin_bar->remove_node('new-media');
+  $wp_admin_bar->remove_node('view-site');
+}
+
+add_action( 'wp_dashboard_setup', 'uhp24_disable_dashboard_items' );
+function uhp24_disable_dashboard_items() {
+  remove_action('admin_notices', 'update_nag');
+	remove_action('welcome_panel', 'wp_welcome_panel');
+	remove_meta_box('dashboard_primary', 'dashboard', 'side');
+	remove_meta_box('dashboard_secondary', 'dashboard', 'side');
+	remove_meta_box('dashboard_quick_press', 'dashboard', 'side');
+	remove_meta_box('dashboard_site_health', 'dashboard', 'normal');
+	
+}
+
+add_filter( 'screen_options_show_screen', '__return_false' );
+
+add_action('admin_menu', function () {
+	remove_menu_page('edit-comments.php');
+});
+
+add_filter( 'custom_menu_order', 'uhp24_menu_order' );
+add_filter( 'menu_order', 'uhp24_menu_order' );
+function uhp24_menu_order( $menu_order ) {
+  if (!$menu_order) return true;
+  return array(
+    'index.php',
+    'separator1',
+    'edit.php?post_type=page',
+    'edit.php',
+    'edit-comments.php',
+    'separator2',
+    'upload.php',
+    'theme-settings',
+    'themes.php',
+    'plugins.php',
+    'tools.php',
+		'users.php',
+    'separator-last'
+  );
+}
+
+add_action( 'admin_menu', 'uhp24_remove_admin_pages', 99 );
+function uhp24_remove_admin_pages() {
+  global $current_user;
+  $user_id = get_current_user_id();
+  if($user_id != '0') {
+  	remove_menu_page('plugins.php');
+    remove_menu_page('tools.php');
+    remove_menu_page('options-general.php');
+    remove_menu_page('gutenberg');
+    remove_menu_page('users.php');
+    remove_submenu_page('themes.php', 'themes-editor.php');
+    remove_submenu_page( 'themes.php', 'customize.php?return=' . urlencode($_SERVER['SCRIPT_NAME']));
+    remove_submenu_page( 'themes.php', 'themes.php' );
+    remove_submenu_page( 'themes.php', 'theme-editor.php' );
+    remove_submenu_page( 'themes.php', 'theme_options' );
+  }
+}
+
+add_action( 'init', 'uhp24_admin_post_labels' );
+function uhp24_admin_post_labels() {
+	global $wp_post_types;
+	$labels = &$wp_post_types['post']->labels;
+	$labels->name = 'News';
+	$labels->singular_name = 'News';
+	$labels->add_new = 'Add News';
+	$labels->add_new_item = 'Add News';
+	$labels->edit_item = 'Edit News';
+	$labels->new_item = 'News';
+	$labels->view_item = 'View News';
+	$labels->search_items = 'Search News';
+	$labels->not_found = 'No News found';
+	$labels->not_found_in_trash = 'No News found in Trash';
+	$labels->all_items = 'All News';
+	$labels->menu_name = 'News';
+	$labels->name_admin_bar = 'News';
+}
+
+
+/***********************************************************
+###################### Last Login ##########################
+************************************************************/
+
+add_action( 'wp_login', 'uhp24_login_timestamp', 20, 2 );
+function uhp24_login_timestamp( $user_login, $user ) {
+  update_user_meta( $user->ID, 'last_login', time() );
+}
+add_filter( 'manage_users_columns', 'uhp24_user_last_login_column' );
+function uhp24_user_last_login_column( $columns ) {
+  $columns['last_login'] = 'Last Login'; // column ID / column Title
+  return $columns;
+}
+add_filter( 'manage_users_custom_column', 'uhp24_last_login_column', 10, 3 );
+function uhp24_last_login_column( $output, $column_id, $user_id ){
+	if( $column_id == 'last_login' ) {
+    $last_login = get_user_meta( $user_id, 'last_login', true );
+    $date_format = 'j M, Y';
+    $output = $last_login ? date( $date_format, $last_login ) : '-';
+	}
+	return $output;
+}
+add_filter( 'manage_users_sortable_columns', 'uhp24_sortable_columns' );
+function uhp24_sortable_columns( $columns ) {
+	return wp_parse_args( array(
+	 	'last_login' => 'last_login'
+	), $columns );
+}
+add_action( 'pre_get_users', 'uhp24_sort_last_login_column' );
+function uhp24_sort_last_login_column( $query ) {
+	if( !is_admin() ) { return; }
+  $orderby = $query->get('orderby');
+	if( 'last_login' == $orderby ) {
+    $query->set('meta_key','last_login');
+    $query->set('orderby','meta_value');
+	}
+	return $query;
+}
+
+
+/***********************************************************
+######################## Editor ############################
+************************************************************/
+
+add_action( 'enqueue_block_assets', 'uhp24_block_styles', 5 );
+function uhp24_block_styles(){
+	wp_enqueue_style('uhp24-css', get_stylesheet_directory_uri() . '/style.css');
+}
+
+//add_action( 'admin_enqueue_scripts', 'uhp24_admin_styles' );
+function uhp24_admin_styles() {
+  wp_enqueue_style( 'style-editor', get_template_directory_uri().'/style-editor.css' );
+}
+
+add_filter( 'should_load_remote_block_patterns', 'uhp24_disable_remote_patterns' );
+function uhp24_disable_remote_patterns() {
+	return false;
+}
+
+
+/***********************************************************
+####################### Comments ###########################
+************************************************************/
+
+add_filter('comments_open', '__return_false', 20, 2);
+add_filter('pings_open', '__return_false', 20, 2);
+
+add_action('admin_init','uhp24_disable_comments');
+function uhp24_disable_comments() {
+	$post_types = get_post_types();
+	foreach ($post_types as $post_type) {
+			if(post_type_supports($post_type,'comments')) {
+					remove_post_type_support($post_type,'comments');
+					remove_post_type_support($post_type,'trackbacks');
+			}
+	}
+}

+ 4 - 5
parts/header.html

@@ -1,15 +1,14 @@
-<!-- wp:group {"style":{"spacing":{"padding":{"top":"30px","bottom":"30px"}}},"className":"has-secondary-color has-contrast-light-background-color has-background","layout":{"type":"constrained"}} -->
-<div class="wp-block-group has-secondary-color has-contrast-light-background-color has-background" style="padding-top:30px;padding-bottom:30px">
+<!-- wp:group {"style":{"spacing":{"padding":{"top":"20px","bottom":"20px"}}},"className":"has-contrast-light-color has-secondary-dark-background-color has-background","layout":{"type":"constrained"}} -->
+<div class="wp-block-group has-contrast-light-color has-secondary-dark-background-color has-background" style="padding-top:20px;padding-bottom:20px">
 	<!-- wp:group {"align":"wide","layout":{"type":"flex","flexWrap":"wrap","justifyContent":"space-between"}} -->
 	<div class="wp-block-group alignwide">
 		<!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|50"},"layout":{"selfStretch":"fit","flexSize":null}},"layout":{"type":"flex"}} -->
     <div class="wp-block-group">
 			<!-- wp:site-logo {"width":180} /-->
-
 		</div>
-	<!-- /wp:group -->
+		<!-- /wp:group -->
 	<!-- wp:navigation {"ref":5,"layout":{"type":"flex","justifyContent":"left","orientation":"horizontal"},"style":{"spacing":{"margin":{"top":"0"},"blockGap":"var:preset|spacing|60"},"layout":{"selfStretch":"fit","flexSize":null}}} /-->
-
+	</div>
 	<!-- /wp:group -->
 </div>
 <!-- /wp:group -->

+ 4 - 4
patterns/footer.php

@@ -8,8 +8,8 @@
  */
 ?>
 
-<!-- wp:group {"align":"full","textColor":"base","backgroundColor":"primary","layout":{"type":"constrained"}} -->
-<div class="wp-block-group alignfull has-text-color-base has-base-color has-primary-background-color has-text-color has-background">
+<!-- wp:group {"align":"full","textColor":"base","backgroundColor":"secondary-dark","layout":{"type":"constrained"}} -->
+<div class="wp-block-group alignfull has-text-color-base has-contrast-light-color has-secondary-dark-background-color has-text-color has-background">
 
 	<!-- wp:group {"align":"wide","style":{"spacing":{"padding":{"top":"var:preset|spacing|70","bottom":"var:preset|spacing|50"}}}} -->
 	<div class="wp-block-group alignwide container" style="padding-top:var(--wp--preset--spacing--70);padding-bottom:var(--wp--preset--spacing--50)">
@@ -49,7 +49,7 @@
 
 				<!-- wp:query -->
 				<div class="wp-block-query">
-					<!-- wp:pattern {"slug":"gwp/query-short"} /-->
+					<!-- wp:pattern {"slug":"uhp/query-short"} /-->
 				</div>
 				<!-- /wp:query -->
 
@@ -66,7 +66,7 @@
 			<!-- wp:group {"style":{"spacing":{"blockGap":"6px"}},"layout":{"type":"flex","flexWrap":"wrap"}} -->
 			<div class="wp-block-group">
 				<!-- wp:paragraph {"fontSize":"small"} -->
-				<p class="has-small-font-size"><?php esc_html_e('&copy;', 'gwp'); ?></p>
+				<p class="has-small-font-size"><?php esc_html_e('&copy;&nbsp;', 'uhp'); echo date("Y");?></p>
 				<!-- /wp:paragraph -->
 				<!-- wp:site-title {"level":0,"style":{"typography":{"fontStyle":"normal","fontWeight":"400"}},"fontSize":"small"} /-->
 			</div>

+ 0 - 0
style-editor.css


+ 31 - 1
style.css

@@ -16,8 +16,38 @@ Twenty Twenty Four  * GNU GPL v2 or later - https://github.com/WordPress/twentyt
 
 */
 
+img {
+  max-width: 100%;
+  height: auto;
+}
+
 .negative-bottom-margin {
-  margin-bottom: -2em !important;
+  margin-bottom: -30px !important;
+  opacity: 1;
 }
 
+.wp-block-navigation a {
+  position: relative;
+}
+.wp-block-navigation a::before {
+  content: "";
+  position: absolute;
+  display: block;
+  width: 100%;
+  height: 2px;
+  bottom: 0;
+  left: 0;
+  background-color: var(--wp--preset--color--highlight);
+  transform: scaleX(0);
+  transition: transform 0.3s ease;
+}
+.wp-block-navigation a:hover::before {
+  transform: scaleX(1);
+}
+.wp-block-latest-posts__post-title {
+  font-weight: 600;
+}
+.wp-block-latest-posts li {
+  margin-bottom: 5em !important;
+}
 

+ 1 - 1
templates/index.html

@@ -3,7 +3,7 @@
 <!-- wp:group {"tagName":"main","style":{"spacing":{"padding":{"top":"var:preset|spacing|60","bottom":"var:preset|spacing|50"}}},"layout":{"type":"constrained"}} -->
 <main class="wp-block-group has-base-background-color has-background" style="padding-top:var(--wp--preset--spacing--60);padding-bottom:var(--wp--preset--spacing--50);">
 	<!-- wp:heading {"level": 1} -->
-	<h1 class="wp-block-heading">News</h1>
+
 	<!-- /wp:heading -->
 	<!-- wp:pattern {"slug":"gwp/query"} /-->
 </main>

+ 41 - 0
templates/single.html

@@ -0,0 +1,41 @@
+<!-- wp:template-part {"slug":"header","tagName":"header","className":"site-header"} /-->
+<!-- wp:spacer {"height":"1rem"} -->
+<div style="height:1rem" aria-hidden="true" class="wp-block-spacer"></div>
+<!-- /wp:spacer -->
+<!-- wp:group {"tagName":"main","style":{"spacing":{"padding":{"top":"var:preset|spacing|80","bottom":"var:preset|spacing|80"}}},"layout":{"type":"default"}} -->
+<main class="wp-block-group" style="padding-top:var(--wp--preset--spacing--80);padding-bottom:var(--wp--preset--spacing--80)">
+	<!-- wp:group {"align":"full","layout":{"type":"constrained"}} -->
+	<div class="wp-block-group alignfull">
+		<!-- wp:post-title {"level":1,"className":"has-secondary-color"} /-->
+		<!-- wp:pattern {"slug":"gwp/hidden-post-meta"} /-->
+	</div>
+	<!-- /wp:group -->
+	<!-- wp:post-content {"layout":{"type":"constrained"}} /-->
+	<!-- wp:spacer {"height":"1rem"} -->
+	<div style="height:1rem" aria-hidden="true" class="wp-block-spacer"></div>
+	<!-- /wp:spacer -->
+	<!-- wp:group {"layout":{"type":"constrained"}} -->
+	<div class="wp-block-group">
+		<!-- wp:post-terms {"term":"post_tag","prefix":"Tags: "} /-->
+		<!-- wp:separator {"backgroundColor":"secondary"} -->
+		<hr class="wp-block-separator has-text-color has-secondary-color has-alpha-channel-opacity has-secondary-background-color has-background"/>
+		<!-- /wp:separator -->
+	</div>
+	<!-- wp:spacer {"height":"1rem"} -->
+	<div style="height:1rem" aria-hidden="true" class="wp-block-spacer"></div>
+	<!-- /wp:spacer -->
+	<!-- /wp:group -->
+	<!-- wp:group {"layout":{"type":"constrained"}} -->
+	<div class="wp-block-group">
+		<!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|60","bottom":"var:preset|spacing|60"}}},"layout":{"type":"flex","justifyContent":"space-between","flexWrap":"wrap"}} -->
+		<div class="wp-block-group" style="padding-top:var(--wp--preset--spacing--60);padding-bottom:var(--wp--preset--spacing--60)">
+			<!-- wp:post-navigation-link {"type":"previous","showTitle":true,"linkLabel":true,"arrow":"arrow"} /-->
+			<!-- wp:post-navigation-link {"showTitle":true,"linkLabel":true,"arrow":"arrow"} /-->
+		</div>
+		<!-- /wp:group -->
+	</div>
+	<!-- /wp:group -->
+</main>
+<!-- /wp:group -->
+
+<!-- wp:template-part {"slug":"footer","tagName":"footer","className":"site-footer"} /-->

+ 7 - 7
theme.json

@@ -27,7 +27,7 @@
 				},
 				{
 					"slug": "contrast",
-					"color": "#808285",
+					"color": "#696B6E",
 					"name": "Contrast"
 				},
 				{
@@ -79,14 +79,14 @@
 			"defaultDuotone": false,
 			"duotone": [
 				{
-					"colors": [ "#009C9F", "#FFFFFF"],
-					"slug": "secondary-primary",
-					"name": "Secondary and primary"
+					"colors": [ "#19458C", "#FFFFFF"],
+					"slug": "secondary-light",
+					"name": "Secondary"
 				},
 				{
-					"colors": ["#19458C", "#FFFFFF"],
-					"slug": "primary-contrast",
-					"name": "Primary and Contrast"
+					"colors": ["#009C9F", "#FFFFFF"],
+					"slug": "primary-light",
+					"name": "Primary Light"
 				}
 			]
 		},