Theme fixes and improvements (#335)

* Adding minimum PHP and WP versions to style.css

* Fix closing div outside if statement in header

* Fixing admin header search input, closes #306

* Adding checks for including LF MU files, ref #284

* Adding admin message to LF MU if the plugin is not installed, ref #284

* Updating pagination styles to match other links, ref #328

* Adding accepted dates to projects link title, ref #261

* Fixing code sniffs

* Changing project date to n/j/Y format

* Adding youtube-nocookie to responsive video wrapper, ref #311
This commit is contained in:
James Hunt 2020-09-23 08:18:50 +02:00 committed by GitHub
parent ad2d633d23
commit f4683848c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 122 additions and 60 deletions

View File

@ -1,13 +1,24 @@
<?php // phpcs:ignoreFile
<?php
/**
* Plugin Name: LF Admin Dashboard Modifications
* WordPress Admin & Dashboard modifications.
*
* Plugin Name: LF Admin & Dashboard Modifications
* Plugin URI: https://github.com/cncf/cncf.io
* Description: Modifies the dashboard in the admin.
* Version: 0.1
* Author: James Hunt
* Author URI: https://cncf.io
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
* Version: 0.1
* License: GPL2+
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: wp-no-base-permalink
*
* @package WordPress
* @subpackage lf-mu
*/
require WPMU_PLUGIN_DIR . '/wp-mu-plugins/lf-admin-dashboard.php';
/**
* Include the LF Admin Dashboard modifications.
*/
if ( file_exists( WPMU_PLUGIN_DIR . '/wp-mu-plugins/lf-admin-dashboard.php' ) ) {
require WPMU_PLUGIN_DIR . '/wp-mu-plugins/lf-admin-dashboard.php';
}

View File

@ -3,18 +3,22 @@
* Core blocks for running the cncf.io site.
*
* Plugin Name: LF Blocks
* Plugin URI: https://www.cncf.io
* Description: Various blocks for use on the CNCF.io site.
* Plugin URI: https://github.com/cncf/cncf.io
* Description: Various blocks for use on the cncf.io site.
* Author: James Hunt
* Author URI: https://www.cncf.io
* Version: 1.0.0
* License: GPL2+
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: lf-mu
*
* @package lf-blocks
* @package WordPress
* @subpackage lf-mu
*/
/**
* Include the LF Blocks plugin
*/
require WPMU_PLUGIN_DIR . '/wp-mu-plugins/lf-blocks/plugin.php';
if ( file_exists( WPMU_PLUGIN_DIR . '/wp-mu-plugins/lf-blocks/plugin.php' ) ) {
require WPMU_PLUGIN_DIR . '/wp-mu-plugins/lf-blocks/plugin.php';
}

View File

@ -2,23 +2,40 @@
/**
* Core functionality for running the cncf.io site.
*
* @link https://cncf.io/
* @since 1.0.0
* @package lfmu
* Plugin Name: LF MU
* Plugin URI: https://github.com/cncf/cncf.io
* Description: Core functionality for running the cncf.io site.
* Author: Chris Abraham, James Hunt
* Author URI: https://www.cncf.io
* Version: 1.1.0
* License: GPL2+
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: lf-mu
*
* @wordpress-plugin
* Plugin Name: LF MU
* Plugin URI: https://github.com/cncf/cncf.io
* Description: Core functionality for running the cncf.io site.
* Version: 1.1.0
* Author: Chris Abraham, James Hunt
* Author URI: https://www.cncf.io
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: lf-mu
* @package WordPress
* @subpackage lf-mu
*/
/**
* Include the LF plugin
* Include the LF MU plugin
*/
require WPMU_PLUGIN_DIR . '/wp-mu-plugins/lf-mu/lf-mu.php';
if ( file_exists( WPMU_PLUGIN_DIR . '/wp-mu-plugins/lf-mu/lf-mu.php' ) ) {
require WPMU_PLUGIN_DIR . '/wp-mu-plugins/lf-mu/lf-mu.php';
} else {
add_action( 'admin_notices', 'lf_theme_lf_mu_admin_notice' );
}
/**
* Custom admin notice if LF MU plugin not installed.
*/
function lf_theme_lf_mu_admin_notice() { ?>
<div class="notice notice-error is-dismissible">
<p><strong>The Linux Foundation CNCF Theme requires the <a href="https://github.com/cncf/wp-mu-plugins" target="_blank">LF MU Plugin</a> to be installed.</strong></p>
<p><a href="https://github.com/cncf/wp-mu-plugins/archive/master.zip">Download the latest version of this plugin</a>, unzip the archive, rename it's containing folder from <code>wp-mu-plugins-master</code> to <code>wp-mu-plugins</code> and then copy the plugin to <code>/wp-content/mu-plugins/</code>.</p>
<p>Visit the <a href="https://github.com/cncf/wp-mu-plugins" target="_blank">LF MU Plugin</a> repo on Github to file any support issues.</p>
</div>
<?php
}

View File

@ -1,13 +1,24 @@
<?php // phpcs:ignoreFile
<?php
/**
*
* Removes category or tag base from permalinks.
*
* Plugin Name: WP No Base Permalink
* Description: Removes category base or tag base (optional) from your category or tag permalinks and removes parents categories from your category permalinks (optional). Forked from https://wordpress.org/plugins/wp-no-base-permalink/ by Sergio ( kallookoo ).
* Version: 9.9
* Author: James Hunt
* Author URI: https://cncf.io
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: wp-no-base-permalink
* Author URI: https://www.cncf.io
* Version: 9.9
* License: GPL2+
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: lf-mu
*
* @package WordPress
* @subpackage lf-mu
*/
require WPMU_PLUGIN_DIR . '/wp-mu-plugins/wp-no-base-permalink.php';
/**
* Include the No Base Permalink plugin
*/
if ( file_exists( WPMU_PLUGIN_DIR . '/wp-mu-plugins/wp-no-base-permalink.php' ) ) {
require WPMU_PLUGIN_DIR . '/wp-mu-plugins/wp-no-base-permalink.php';
}

View File

@ -28,8 +28,8 @@ endif;
<img src="<?php echo esc_url( wp_get_attachment_url( $options['header_image_id'] ) ); ?>"
height="38" alt="<?php echo bloginfo( 'name' ); ?>">
</a>
<?php } ?>
</div>
<?php } ?>
<div class="menu-container-with-search" role="navigation">
<nav class="site-navigation">
@ -52,12 +52,10 @@ endif;
<?php endif; ?>
<div class="header-search">
<button
class="button
<button class="button
search-toggle
search-button
header-align"
type="button" aria-label="Search">
header-align" type="button" aria-label="Search">
<?php $image->get_svg( 'search.svg' ); ?>
</button>
@ -67,23 +65,28 @@ endif;
<form class="search-form" method="get"
action="<?php echo esc_url( home_url() ); ?>"
role="search">
<label for="search-bar" class="screen-reader-text">Search CNCF</label>
<input class="search-input" type="search" name="s" id="search-bar" value="<?php echo get_search_query(); ?>" placeholder="Search for..." title="Search for" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" required>
<label for="search-bar"
class="screen-reader-text">Search
CNCF</label>
<input class="search-input" type="search"
id="search-bar"
value="<?php echo esc_attr( get_search_query() ); ?>"
name="s" placeholder="Search for..."
title="Search for" autocomplete="off"
autocorrect="off" autocapitalize="off"
spellcheck="false"
maxlength="98"
required>
<label>
<input class="button transparent
header-align
search-submit"
type="submit" value="Search" />
search-submit" type="submit" value="Search" />
</label>
</form>
<button
class="button
search-toggle
search-button
header-align"
type="button" aria-label="Close">
<?php $image->get_svg( 'close.svg' ); ?>
</button>
<button class="button search-toggle search-button header-align" type="button" aria-label="Close">
<?php $image->get_svg( 'close.svg' ); ?>
</button>
</div>
</div>
@ -91,7 +94,8 @@ endif;
</nav>
</div>
<button class="hamburger hamburger--spin" type="button" aria-label="Toggle Menu">
<button class="hamburger hamburger--spin" type="button"
aria-label="Toggle Menu">
<span class="hamburger-box">
<span class="hamburger-inner"></span>
</span>

View File

@ -56,6 +56,8 @@ function add_projects_shortcode( $atts ) {
$external_url = get_post_meta( get_the_ID(), 'lf_project_external_url', true );
$date_accepted = get_post_meta( get_the_ID(), 'lf_project_date_accepted', true ) ? ' (accepted to CNCF on ' . gmdate( 'n/j/Y', strtotime( get_post_meta( get_the_ID(), 'lf_project_date_accepted', true ) ) ) . ')' : '';
$project_category = get_post_meta( get_the_ID(), 'lf_project_category', true );
$github = get_post_meta( get_the_ID(), 'lf_project_github', true );
@ -86,7 +88,7 @@ function add_projects_shortcode( $atts ) {
<?php
if ( $external_url ) :
?>
<a href="<?php echo esc_url( $external_url ); ?>" rel="noopener" target="_blank" title="<?php the_title(); ?>">
<a href="<?php echo esc_url( $external_url ); ?>" rel="noopener" target="_blank" title="<?php echo esc_html( the_title() . $date_accepted ); ?>">
<?php
endif;
@ -106,7 +108,7 @@ function add_projects_shortcode( $atts ) {
<h3 class="project-title">
<?php if ( $external_url ) : ?>
<a href="<?php echo esc_url( $external_url ); ?>" rel="noopener" target="_blank">
<a href="<?php echo esc_url( $external_url ); ?>" rel="noopener" target="_blank" title="Visit <?php the_title(); ?>">
<?php
endif;
the_title();

View File

@ -45,7 +45,10 @@ jQuery( document ).ready(
} else {
$( '.search-bar' ).show();
$( '.search-bar' ).addClass( 'is-active' );
$( '.search-input' ).focus().val( $( 'input' ).val() );
// put the cursor in the input field.
document.getElementById( "search-bar" ).focus();
// de-select text and move cursor to the end.
document.getElementById( "search-bar" ).setSelectionRange( 99, 99 );
}
},
);

View File

@ -10,7 +10,7 @@
jQuery(
function( $ ) {
$(
'iframe[src*="youtube.com"], iframe[src*="vimeo.com"], iframe[data-src*="youtube.com"], iframe[data-src*="vimeo.com"], iframe[src*="qq.com"]'
'iframe[src*="youtube.com"], iframe[src*="vimeo.com"], iframe[data-src*="youtube.com"], iframe[data-src*="vimeo.com"], iframe[src*="qq.com"], iframe[src*="youtube-nocookie.com"]'
).each(
function() {
$( this ).wrap( '<div class="video-wrapper"></div>' );

View File

@ -14,6 +14,7 @@
white-space: nowrap;
display: inline;
border: 1px solid $primary-color;
}
>*:not(:last-child) {
@ -39,19 +40,20 @@
}
a {
color: $primary-color;
text-decoration: none;
background-color: $primary-color;
color: $white;
&:hover,
&:focus {
background-color: $primary-color;
color: $white;
background-color: $link-hover;
}
}
.current {
background-color: $primary-color;
color: $white;
border-color: $primary-color;
background-color: $white;
color: $primary-color;
}
.next,
@ -60,6 +62,11 @@
padding-right: 10px;
}
.dots {
border-color: transparent;
color: $primary-color;
}
@media (max-width: 500px) {
.page-numbers:not(.current):not(.next):not(.prev),

View File

@ -2,8 +2,11 @@
Theme Name: CNCF Theme
Theme URI: https://github.com/cncf/cncf.io
Author: James Hunt, Chris Abraham
Author URI: https://cncf.io
Author URI: https://www.cncf.io
Version: 1.0.0
Requires at least: 5.5
Tested up to: 5.5.1
Requires PHP: 7.0
Text Domain: lf-theme
Description: A custom theme developed for CNCF website, see the Github repo for usage instructions.