Skip to content

Commit

Permalink
Merge branch 'feature/pagespeed-dev-2' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
Ipstenu committed Jun 28, 2024
2 parents 02cde9c + fd1b77b commit 0c3cc51
Show file tree
Hide file tree
Showing 63 changed files with 1,242 additions and 272 deletions.
11 changes: 7 additions & 4 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@
module.exports = function(grunt) {

grunt.initConfig({

// js minification
terser: {
dist: {
files: {
// admin scripts
'inc/js/yikes-theme-scripts.min.js': [ // theme specific script
'inc/js/yikes-theme-scripts.min.js': [ // theme specific scripts
'inc/js/navigation.js' , 'inc/js/skip-link-focus-fix.js' , 'inc/js/lwtv-theme-scripts.js' , 'inc/js/a11y.js'
],
'inc/js/customizer.min.js': [ // customizer specific script
'inc/js/customizer.min.js': [ // customizer specific script
'inc/js/customizer.js'
],
'inc/js/bootstrap-color-mode.min.js': [ // bootstrap color mode script
'inc/js/bootstrap-color-mode.js'
],
}
}
},
Expand All @@ -29,7 +32,7 @@ module.exports = function(grunt) {
}
}
},

// css minify contents of our directory and add .min.css extension
cssmin: {
target: {
Expand Down
4 changes: 2 additions & 2 deletions archive-post_type_actors.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@
/* Start the Loop */
while ( have_posts() ) :
the_post();
get_template_part( 'template-parts/excerpt', 'post_type_actors', array( 'actor' => get_the_ID() ) );
get_template_part( 'template-parts/excerpt/actors', '', array( 'actor' => get_the_ID() ) );
endwhile;
} else {
get_template_part( 'template-parts/content', 'none' );
get_template_part( 'template-parts/content/none' );
}
?>
</div><!-- .row .site-loop -->
Expand Down
4 changes: 2 additions & 2 deletions archive-post_type_characters.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@
/* Start the Loop */
while ( have_posts() ) {
the_post();
get_template_part( 'template-parts/excerpt', 'post_type_characters', array( 'character' => get_the_ID() ) );
get_template_part( 'template-parts/excerpt/characters', '', array( 'character' => get_the_ID() ) );
}
} else {
get_template_part( 'template-parts/content', 'none' );
get_template_part( 'template-parts/content/none' );
}
?>
</div><!-- .row .site-loop -->
Expand Down
4 changes: 2 additions & 2 deletions archive-post_type_shows.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@
/* Start the Loop */
while ( have_posts() ) {
the_post();
get_template_part( 'template-parts/excerpt', 'post_type_shows' );
get_template_part( 'template-parts/excerpt/shows' );
}
} else {
get_template_part( 'template-parts/content', 'none' );
get_template_part( 'template-parts/content/none' );
}
?>
</div>
Expand Down
4 changes: 2 additions & 2 deletions archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@
<?php
while ( have_posts() ) :
the_post();
get_template_part( 'template-parts/content', 'posts' );
get_template_part( 'template-parts/content/posts' );
endwhile;
else :
get_template_part( 'template-parts/content', 'none' );
get_template_part( 'template-parts/content/none' );
endif;
?>
</div>
Expand Down
4 changes: 1 addition & 3 deletions embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
the_post();

switch ( get_post_type() ) {
//case 'post_type_actors':
//case 'post_type_characters':
case 'post_type_shows':
get_template_part( 'template-parts/embed-content', get_post_type() );
get_template_part( 'template-parts/embed/' . get_post_type() );
break;
default:
get_template_part( 'embed', 'content' );
Expand Down
5 changes: 4 additions & 1 deletion footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@

<!--
If you're reading this source code, hi!
Everything can be found at https://github.com/lezwatch/lwtv-underscores
Everything can be found at the following URLs:
Theme - https://github.com/lezwatch/lwtv-underscores
Plugin - https://github.com/lezwatch/lwtv-plugin

You're welcome to fork our code and make your own site with it.
-->

Expand Down
11 changes: 8 additions & 3 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ function lwtv_admin_notice_missing_plugin() {
// Versioning for efficient developers.
if ( ! defined( 'LWTV_THEME_VERSION' ) ) {
$versions = array(
'lwtv-underscores' => '6.0.5', // Bump this any time you make serious CSS changes.
'lwtv-underscores' => '6.1.1', // Bump this any time you make serious CSS changes.
'font-awesome' => '6.5.2', // Bump when you update Font Awesome.
'bootstrap' => '5.3.3', // Bump when you update bootstrap.
'bootstrap_dark' => '1.0', // Bump when you update the dark mode.
'lwtv-blocks' => '1.0.0', // Bump when you update the blocks.
'yikes-nav' => '20240318', // Last date this was updated.
);
Expand Down Expand Up @@ -125,7 +126,9 @@ function lwtv_custom_excerpt_length( $length ) {
*
* Add bio box.
*/
require_once 'inc/author-box.php';
if ( ! is_singular( 'post' ) ) {
require_once 'inc/author-box.php';
}

/**
* Archives
Expand Down Expand Up @@ -396,11 +399,13 @@ function yikes_starter_scripts() {
$lwtv_underscores = $get_theme_vers['lwtv-underscores'];
$font_awesome = $get_theme_vers['font-awesome'];
$bootstrap = $get_theme_vers['bootstrap'];
$bootstrap_dark = $get_theme_vers['bootstrap_dark'];
$yikes_nav = $get_theme_vers['yikes-nav'];

// combined + minified.
// navigation.js, skip-link-focus-fix.js & a11y.js.
// navigation.js, skip-link-focus-fix.js, a11y.js, bootstrap-color-mode.
wp_enqueue_script( 'yikes-starter-navigation', get_template_directory_uri() . '/inc/js/yikes-theme-scripts.min.js', array(), $yikes_nav, true );
wp_enqueue_script( 'lwtv-dark-mode', get_template_directory_uri() . '/inc/js/bootstrap-color-mode.min.js', array(), $bootstrap_dark, false );

if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
Expand Down
55 changes: 6 additions & 49 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,61 +13,24 @@
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">

<?php get_template_part( 'template-parts/header', 'lcp', array( 'post_id' => get_the_ID() ) ); ?>
<?php get_template_part( 'template-parts/header/lcp', '', array( 'post_id' => get_the_ID() ) ); ?>

<?php wp_head(); ?>
</head>

<body <?php body_class(); ?>>

<header id="masthead" class="site-header" role="banner">
<nav id="site-navigation" class="navbar fixed-top navbar-expand-md navbar-light bg-light main-nav" role="navigation">
<div class="container">
<div class="screen-reader-text">
<a href="#main">Skip to Main Content</a>
</div>
<a class="navbar-brand" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home" class="navbar-brand">
<img src="<?php echo esc_url( get_template_directory_uri() ); ?>/images/lezwatch-logo-icon.png" alt="Return to <?php bloginfo( 'name' ); ?> homepage" width="72px" height="80px">
<span class="navbar-brand-text">
<?php bloginfo( 'name' ); ?>
</span>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarToggleLWTV" aria-controls="navbarToggleLWTV" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarToggleLWTV">
<?php
wp_nav_menu(
array(
'menu' => 'primary',
'theme_location' => 'primary',
'depth' => 3,
'container' => false,
'menu_class' => 'navbar-nav ms-auto',
'fallback_cb' => 'wp_page_menu',
'walker' => new WP_Bootstrap_Navwalker(),
'items_wrap' => '<ul id="%1$s" class="%2$s" aria-labelledby="main-navigation">%3$s</ul>',
)
);
?>
</div>

<span class="nav-item search" id="search-btn">
<a class="nav-link" data-bs-toggle="collapse" role="button" data-bs-target="#collapseSearch" href="#collapseSearch" aria-expanded="false">
<?php echo lwtv_symbolicons( 'search.svg', 'fa-search' ); ?>
<span class="screen-reader-text">Search the Site</span>
</a>
</span>
</div>
</nav><!-- #site-navigation -->
<?php get_template_part( 'template-parts/header/navbar' ); ?>

<div class="collapse fixed-top header-search-bar" id="collapseSearch">
<div class="container">
<div class="row">
<div class="col">
<div class="search-body">
<div class="search-box">
<?php get_template_part( 'template-parts/searchbox' ); ?>
<?php get_template_part( 'template-parts/header/searchbox' ); ?>
</div>
</div>
</div>
Expand All @@ -81,15 +44,9 @@
<?php
if ( is_front_page() && ( 0 == get_query_var( 'page' ) || '' == get_query_var( 'page' ) ) ) { // phpcs:ignore Universal.Operators.StrictComparisons.LooseEqual
?>
<div class="alert alert-danger" role="alert">
<div class="container">
<div class="row">
<div class="col dead-widget-container">
<center><?php echo wp_kses_post( lwtv_last_death() ); ?></center>
</div>
</div>
</div>
</div>

<?php get_template_part( 'template-parts/header/last-death' ); ?>

<div class="jumbotron jumbotron-fluid"
<?php if ( get_header_image() ) : ?>
style="background-image: url(<?php header_image(); ?>);"
Expand Down
81 changes: 81 additions & 0 deletions inc/js/bootstrap-color-mode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*!
* Color mode toggler for Bootstrap's docs (https://getbootstrap.com/)
* Copyright 2011-2024 The Bootstrap Authors
* Licensed under the Creative Commons Attribution 3.0 Unported License.
*/

(() => {
'use strict'

const getStoredTheme = () => localStorage.getItem('theme')
const setStoredTheme = theme => localStorage.setItem('theme', theme)

const getPreferredTheme = () => {
const storedTheme = getStoredTheme()
if (storedTheme) {
return storedTheme
}

return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
}

const setTheme = theme => {
if (theme === 'auto') {
document.documentElement.setAttribute('data-bs-theme', (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'))
} else {
document.documentElement.setAttribute('data-bs-theme', theme)
}
}

setTheme(getPreferredTheme())

const showActiveTheme = (theme, focus = false) => {
const themeSwitcher = document.querySelector('#bd-theme')

if (!themeSwitcher) {
return
}

const themeSwitcherText = document.querySelector('#bd-theme-text')
const activeThemeIcon = document.querySelector('.theme-icon-active use')
const btnToActive = document.querySelector(`[data-bs-theme-value="${theme}"]`)
const svgOfActiveBtn = btnToActive.querySelector('svg use').getAttribute('href')

document.querySelectorAll('[data-bs-theme-value]').forEach(element => {
element.classList.remove('active')
element.setAttribute('aria-pressed', 'false')
})

btnToActive.classList.add('active')
btnToActive.setAttribute('aria-pressed', 'true')
activeThemeIcon.setAttribute('href', svgOfActiveBtn)
const themeSwitcherLabel = `${themeSwitcherText.textContent} (${btnToActive.dataset.bsThemeValue})`
themeSwitcher.setAttribute('aria-label', themeSwitcherLabel)

if (focus) {
themeSwitcher.focus()
}
}

window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
const storedTheme = getStoredTheme()
if (storedTheme !== 'light' && storedTheme !== 'dark') {
setTheme(getPreferredTheme())
}
})

window.addEventListener('DOMContentLoaded', () => {
showActiveTheme(getPreferredTheme())

document.querySelectorAll('[data-bs-theme-value]')
.forEach(toggle => {
toggle.addEventListener('click', () => {
const theme = toggle.getAttribute('data-bs-theme-value')
setStoredTheme(theme)
setTheme(theme)
showActiveTheme(theme, true)
})
})
})
})()

6 changes: 6 additions & 0 deletions inc/js/bootstrap-color-mode.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
echo '<div class="row site-loop main-posts-loop">';
while ( have_posts() ) {
the_post();
get_template_part( 'template-parts/content', 'posts' );
get_template_part( 'template-parts/content/posts' );
}
echo '</div>';
wp_bootstrap_pagination();
} else {
get_template_part( 'template-parts/content', 'none' );
get_template_part( 'template-parts/content/none' );
}
?>
</div>
Expand Down
Loading

0 comments on commit 0c3cc51

Please sign in to comment.