Merge pull request #27 from Rumperuu/feature/post-meta

Add post meta, styling tweaks, massive linting
This commit is contained in:
Ben Goldsworthy 2021-01-22 16:22:55 +00:00 committed by GitHub
commit 3a97551bf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 666 additions and 2177 deletions

View file

@ -2,8 +2,7 @@
/** /**
* The template for displaying search results pages * The template for displaying search results pages
* *
* @package WordPress * @package Twenty_Sixteen
* @subpackage Twenty_Sixteen
* @since Twenty Sixteen 1.0 * @since Twenty Sixteen 1.0
*/ */
@ -15,7 +14,7 @@ get_header(); ?>
<?php if ( have_posts() ) : ?> <?php if ( have_posts() ) : ?>
<header class="page-header"> <header class="page-header">
<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentysixteen' ), '<span>' . esc_html( get_search_query() ) . '</span>' ); ?></h1> <!-- TODO: Add header -->
</header><!-- .page-header --> </header><!-- .page-header -->
<?php <?php

18
404.php
View file

@ -1,18 +1,16 @@
<?php <?php
/** /**
* The template for displaying 404 (not found) errors. * The template for displaying 404 (not found) errors.
* *
* @package WordPress * @package Omphaloskepsis
* @subpackage Omphaloskepsis * @since Omphaloskepsis 1.0
* @since Omphaloskepsis 1.0 */
*/
?>
<?php get_header(); ?> get_header(); ?>
<main id="centred-page" role="main"> <main id="centred-page" role="main">
<h1>404.</h1> <h1>404.</h1>
<h2>That's &lsquo;computer&rsquo; for <q>Oops! Something went wrong!</q></h2> <h2>That's <q>computer</q> for <q>Oops! Something went wrong!</q></h2>
</main><!-- .site-main --> </main><!-- .site-main -->
<?php get_footer(); ?> <?php get_footer(); ?>

View file

@ -1,25 +1,25 @@
<?php <?php
/** /**
* The template for displaying portfolio archives. * The template for displaying portfolio archives.
* *
* @package WordPress * @package Omphaloskepsis
* @subpackage Omphaloskepsis * @since Omphaloskepsis 1.0
* @since Omphaloskepsis 1.0 */
*/
?>
<?php get_header(); ?> get_header(); ?>
<main id="list-page" class="col-10 col-m-12" role="main"> <main id="list-page" class="col-10 col-m-12" role="main">
<header> <header>
<h1><?php echo ( get_post_type() == 'post' ) ? single_cat_title() : ucfirst( get_post_type() ) . 's'; ?>.</h1> <h1><?php echo wp_kses_post( ( 'post' === get_post_type() ) ? single_cat_title() : ucfirst( get_post_type() ) . 's' ); ?>.</h1>
<?php <?php
echo get_the_posts_pagination( echo wp_kses_post(
array( get_the_posts_pagination(
'screen_reader_text' => ' ', array(
'mid_size' => 20, 'screen_reader_text' => ' ',
'prev_text' => '', 'mid_size' => 20,
'next_text' => '', 'prev_text' => '',
'next_text' => '',
)
) )
); );
?> ?>
@ -31,6 +31,7 @@
// Start the loop. // Start the loop.
while ( have_posts() ) : while ( have_posts() ) :
the_post(); the_post();
/* /*
* Include the Post-Format-specific template for the content. * Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file * If you want to override this in a child theme, then include a file
@ -48,12 +49,14 @@
<footer> <footer>
<?php <?php
echo get_the_posts_pagination( echo wp_kses_post(
array( get_the_posts_pagination(
'screen_reader_text' => ' ', array(
'mid_size' => 20, 'screen_reader_text' => ' ',
'prev_text' => '', 'mid_size' => 20,
'next_text' => '', 'prev_text' => '',
'next_text' => '',
)
) )
); );
?> ?>

View file

@ -1,27 +1,21 @@
<?php <?php
/* /**
* Template Name: Centred Page * Template Name: Centred Page
*/ *
* Displays a full-screen page with content in the center.
*
* @package Omphaloskepsis
* @since Omphaloskepsis 1.0
*/
/** get_header(); ?>
*
*
* Displays a full-screen page with content in the center.
*
* @package WordPress
* @subpackage Omphaloskepsis
* @since Omphaloskepsis 1.0
*/
?>
<?php get_header(); ?>
<main id="centred-page" role="main"> <main id="centred-page" role="main">
<?php <?php
while ( have_posts() ) : while ( have_posts() ) :
the_post(); the_post();
?> ?>
<h1><?php echo get_the_title(); ?></h1> <h1><?php echo wp_kses_post( get_the_title() ); ?></h1>
<h2><?php the_content(); ?></h2> <h2><?php the_content(); ?></h2>
<?php endwhile; ?> <?php endwhile; ?>
</main> </main>

View file

@ -1,13 +1,12 @@
<?php <?php
/** /**
* The template for displaying comments. * The template for displaying comments.
* *
* @package WordPress * @package Omphaloskepsis
* @subpackage Omphaloskepsis * @since Omphaloskepsis 1.0
* @since Omphaloskepsis 1.0 */
*/
/* /*
* If the current post is protected by a password and * If the current post is protected by a password and
* the visitor has not yet entered the password we will * the visitor has not yet entered the password we will
* return early without loading the comments. * return early without loading the comments.
@ -41,7 +40,7 @@ if ( post_password_required() ) {
<p id="no-comments">No comments yet.</p> <p id="no-comments">No comments yet.</p>
<?php endif; ?> <?php endif; ?>
<?php if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?> <?php if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
<p class="no-comments"><?php _e( 'Comments are closed.', 'twentysixteen' ); ?></p> <p class="no-comments"><?php wp_kses_post_e( 'Comments are closed.', 'twentysixteen' ); ?></p>
<?php endif; ?> <?php endif; ?>
</div> </div>

View file

@ -1,13 +1,14 @@
<?php <?php
/** /**
* The template for displaying the footer * The template for displaying the footer
* *
* @package Omphaloskepsis * @package Omphaloskepsis
* @since Omphaloskepsis 1.0 * @since Omphaloskepsis 1.0
*/ */
?> ?>
<footer id="site-footer" class="show"> <footer id="site-footer" class="show">
<p>By <a href="/">Ben</a> | <a href="https://github.com/Rumperuu/Omphaloskepsis/issues" target="_blank" rel="noopener noreferrer">Theme Issues</a> | <a href="/privacy-policy">Privacy Policy</a></p> <p>By <a href="/">Ben</a> | <a href="https://github.com/Rumperuu/Omphaloskepsis/issues" target="_blank" rel="noopener noreferrer">Report an Issue</a> | <a href="/privacy-policy">Privacy Policy</a></p>
</footer> </footer>
<script type="text/javascript"> <script type="text/javascript">

View file

@ -6,35 +6,13 @@
* theme as custom template tags. Others are attached to action and filter * theme as custom template tags. Others are attached to action and filter
* hooks in WordPress to change core functionality. * hooks in WordPress to change core functionality.
* *
* When using a child theme you can override certain functions (those wrapped * @package omphaloskepsis
* in a function_exists() call) by defining them first in your child theme's
* functions.php file. The child theme's functions.php file is included before
* the parent theme's file, so the child theme functions would be used.
*
* @link https://codex.wordpress.org/Theme_Development
* @link https://codex.wordpress.org/Child_Themes
*
* Functions that are not pluggable (not wrapped in function_exists()) are
* instead attached to a filter or action hook.
*
* For more information on hooks, actions, and filters,
* {@link https://codex.wordpress.org/Plugin_API}
*
* @package WordPress
* @subpackage omphaloskepsis
* @since Omphaloskepsis 1.0 * @since Omphaloskepsis 1.0
*/ */
/**
* Omphaloskepsis only works in WordPress 4.4 or later.
*/
if ( version_compare( $GLOBALS['wp_version'], '4.4-alpha', '<' ) ) {
require get_template_directory() . '/inc/back-compat.php';
}
// This sets the correct background colour for any LaTeX. // This sets the correct background colour for any LaTeX.
global $themecolors; global $themecolors;
$themecolors['bg'] = 'FFFFF0'; $themecolors['bg'] = 'FFFFF0';
$themecolors['text'] = '020202'; $themecolors['text'] = '020202';
if ( ! function_exists( 'omphaloskepsis_setup' ) ) : if ( ! function_exists( 'omphaloskepsis_setup' ) ) :
@ -97,32 +75,6 @@ if ( ! function_exists( 'omphaloskepsis_setup' ) ) :
) )
); );
function omphaloskepsis_infinite_scroll_init() {
add_theme_support(
'infinite-scroll',
array(
'container' => 'main',
'render' => 'omphaloskepsis_infinite_scroll_render',
'footer' => 'colophon',
)
);
}
add_action( 'init', 'omphaloskepsis_infinite_scroll_init' );
/**
* Custom render function for Infinite Scroll.
*/
function omphaloskepsis_infinite_scroll_render() {
while ( have_posts() ) {
the_post();
if ( is_search() ) {
get_template_part( 'template-parts/content', 'search' );
} else {
get_template_part( 'template-parts/content', get_post_format() );
}
}
}
/* /*
* Switch default core markup for search form, comment form, and comments * Switch default core markup for search form, comment form, and comments
* to output valid HTML5. * to output valid HTML5.
@ -167,7 +119,7 @@ if ( ! function_exists( 'omphaloskepsis_setup' ) ) :
// Indicate widget sidebars can use selective refresh in the Customizer. // Indicate widget sidebars can use selective refresh in the Customizer.
add_theme_support( 'customize-selective-refresh-widgets' ); add_theme_support( 'customize-selective-refresh-widgets' );
} }
endif; // omphaloskepsis_setup endif;
add_action( 'after_setup_theme', 'omphaloskepsis_setup' ); add_action( 'after_setup_theme', 'omphaloskepsis_setup' );
/** /**
@ -292,12 +244,13 @@ add_action( 'wp_head', 'omphaloskepsis_javascript_detection', 0 );
* @since Omphaloskepsis 1.0 * @since Omphaloskepsis 1.0
*/ */
function omphaloskepsis_scripts() { function omphaloskepsis_scripts() {
// phpcs:disable WordPress.WP.EnqueuedResourceParameters
// Load the normalisation stylesheet. // Load the normalisation stylesheet.
wp_enqueue_style( 'omphaloskepsis-reset', get_template_directory_uri() . '/css/reset.css', array(), null ); wp_enqueue_style( 'omphaloskepsis-reset', get_template_directory_uri() . '/css/reset.css', array() );
wp_style_add_data( 'omphaloskepsis-ie', 'conditional', 'lt IE 10' ); wp_style_add_data( 'omphaloskepsis-ie', 'conditional', 'lt IE 10' );
// Add custom fonts, used in the main stylesheet. // Add custom fonts, used in the main stylesheet.
wp_enqueue_style( 'omphaloskepsis-fonts', omphaloskepsis_fonts_url(), array(), null ); wp_enqueue_style( 'omphaloskepsis-fonts', omphaloskepsis_fonts_url(), array() );
// Add Genericons, used in the main stylesheet. // Add Genericons, used in the main stylesheet.
wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.4.1' ); wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.4.1' );
@ -345,6 +298,7 @@ function omphaloskepsis_scripts() {
'collapse' => __( 'collapse child menu', 'omphaloskepsis' ), 'collapse' => __( 'collapse child menu', 'omphaloskepsis' ),
) )
); );
// phpcs:enable
} }
add_action( 'wp_enqueue_scripts', 'omphaloskepsis_scripts' ); add_action( 'wp_enqueue_scripts', 'omphaloskepsis_scripts' );
@ -397,7 +351,7 @@ function omphaloskepsis_hex2rgb( $color ) {
$r = hexdec( substr( $color, 0, 1 ) . substr( $color, 0, 1 ) ); $r = hexdec( substr( $color, 0, 1 ) . substr( $color, 0, 1 ) );
$g = hexdec( substr( $color, 1, 1 ) . substr( $color, 1, 1 ) ); $g = hexdec( substr( $color, 1, 1 ) . substr( $color, 1, 1 ) );
$b = hexdec( substr( $color, 2, 1 ) . substr( $color, 2, 1 ) ); $b = hexdec( substr( $color, 2, 1 ) . substr( $color, 2, 1 ) );
} else if ( strlen( $color ) === 6 ) { } elseif ( strlen( $color ) === 6 ) {
$r = hexdec( substr( $color, 0, 2 ) ); $r = hexdec( substr( $color, 0, 2 ) );
$g = hexdec( substr( $color, 2, 2 ) ); $g = hexdec( substr( $color, 2, 2 ) );
$b = hexdec( substr( $color, 4, 2 ) ); $b = hexdec( substr( $color, 4, 2 ) );
@ -406,21 +360,12 @@ function omphaloskepsis_hex2rgb( $color ) {
} }
return array( return array(
'red' => $r, 'red' => $r,
'green' => $g, 'green' => $g,
'blue' => $b, 'blue' => $b,
); );
} }
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/** /**
* Add custom image sizes attribute to enhance responsive image functionality * Add custom image sizes attribute to enhance responsive image functionality
@ -436,13 +381,13 @@ require get_template_directory() . '/inc/customizer.php';
function omphaloskepsis_content_image_sizes_attr( $sizes, $size ) { function omphaloskepsis_content_image_sizes_attr( $sizes, $size ) {
$width = $size[0]; $width = $size[0];
840 <= $width && $sizes = '(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px'; $sizes = ( 840 <= $width ) ? '(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px' : '';
if ( 'page' === get_post_type() ) { if ( 'page' === get_post_type() ) {
840 > $width && $sizes = '(max-width: ' . $width . 'px) 85vw, ' . $width . 'px'; $sizes = ( 840 > $width ) ? '(max-width: ' . $width . 'px) 85vw, ' . $width . 'px' : '';
} else { } else {
840 > $width && 600 <= $width && $sizes = '(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px'; $sizes = ( 840 > $width && 600 <= $width ) ? '(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px' : '';
600 > $width && $sizes = '(max-width: ' . $width . 'px) 85vw, ' . $width . 'px'; $sizes = ( 600 > $width ) ? '(max-width: ' . $width . 'px) 85vw, ' . $width . 'px' : '';
} }
return $sizes; return $sizes;
@ -462,8 +407,8 @@ add_filter( 'wp_calculate_image_sizes', 'omphaloskepsis_content_image_sizes_attr
*/ */
function omphaloskepsis_post_thumbnail_sizes_attr( $attr, $attachment, $size ) { function omphaloskepsis_post_thumbnail_sizes_attr( $attr, $attachment, $size ) {
if ( 'post-thumbnail' === $size ) { if ( 'post-thumbnail' === $size ) {
is_active_sidebar( 'sidebar-1' ) && $attr['sizes'] = '(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 60vw, (max-width: 1362px) 62vw, 840px'; $attr['sizes'] = ( is_active_sidebar( 'sidebar-1' ) ) ? '(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 60vw, (max-width: 1362px) 62vw, 840px' : '';
! is_active_sidebar( 'sidebar-1' ) && $attr['sizes'] = '(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 88vw, 1200px'; $attr['sizes'] = ( is_active_sidebar( 'sidebar-1' ) ) ? '(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 88vw, 1200px' : '';
} }
return $attr; return $attr;
} }
@ -478,22 +423,35 @@ add_filter( 'wp_get_attachment_image_attributes', 'omphaloskepsis_post_thumbnail
* @return array A new modified arguments. * @return array A new modified arguments.
*/ */
function omphaloskepsis_widget_tag_cloud_args( $args ) { function omphaloskepsis_widget_tag_cloud_args( $args ) {
$args['largest'] = 1; $args['largest'] = 1;
$args['smallest'] = 1; $args['smallest'] = 1;
$args['unit'] = 'em'; $args['unit'] = 'em';
return $args; return $args;
} }
add_filter( 'widget_tag_cloud_args', 'omphaloskepsis_widget_tag_cloud_args' ); add_filter( 'widget_tag_cloud_args', 'omphaloskepsis_widget_tag_cloud_args' );
/**
* Cleans up script tags.
*
* @param string $input The script tag.
* @return sting The cleaned-up script tag.
*/
function clean_script_tag( $input ) { function clean_script_tag( $input ) {
$input = str_replace( "type='text/javascript' ", '', $input ); $input = str_replace( "type='text/javascript' ", '', $input );
return str_replace( "'", '"', $input ); return str_replace( "'", '"', $input );
} }
add_filter( 'script_loader_tag', 'clean_script_tag' ); add_filter( 'script_loader_tag', 'clean_script_tag' );
/**
* Renders the content of a post.
*
* @param string $content The post content.
* @return string The rendered post content.
*/
function omphaloskepsis_the_content( $content ) { function omphaloskepsis_the_content( $content ) {
global $post; global $post;
if ( $post->post_type == 'program' ) { if ( 'program' === $post->post_type ) {
// phpcs:disable Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure
if ( $meta = get_post_meta( $post->ID, 'Link', true ) ) { if ( $meta = get_post_meta( $post->ID, 'Link', true ) ) {
$links = $links . '<a class="hyperlink-button" target="_blank" href="' . $meta . '">Download</a>'; $links = $links . '<a class="hyperlink-button" target="_blank" href="' . $meta . '">Download</a>';
} }
@ -510,7 +468,7 @@ function omphaloskepsis_the_content( $content ) {
$links = $links . '<p class="checksum">MD5 checksum: ' . $meta . '</p>'; $links = $links . '<p class="checksum">MD5 checksum: ' . $meta . '</p>';
} }
return $content . $links; return $content . $links;
} elseif ( $post->post_type == 'website' ) { } elseif ( 'website' === $post->post_type ) {
if ( $meta = get_post_meta( $post->ID, 'Link', true ) ) { if ( $meta = get_post_meta( $post->ID, 'Link', true ) ) {
$links = $links . '<a class="hyperlink-button" target="_blank" href="' . $meta . '">Visit</a>'; $links = $links . '<a class="hyperlink-button" target="_blank" href="' . $meta . '">Visit</a>';
} }
@ -521,7 +479,7 @@ function omphaloskepsis_the_content( $content ) {
$links = $links . '<a class="hyperlink-button" target="_blank" href="' . $meta . '">Licence</a>'; $links = $links . '<a class="hyperlink-button" target="_blank" href="' . $meta . '">Licence</a>';
} }
return $content . $links; return $content . $links;
} elseif ( $post->post_type == 'writing' ) { } elseif ( 'writing' === $post->post_type ) {
if ( $meta = get_post_meta( $post->ID, 'Link', true ) ) { if ( $meta = get_post_meta( $post->ID, 'Link', true ) ) {
$links = $links . '<a class="hyperlink-button" target="_blank" href="' . $meta . '">Read</a>'; $links = $links . '<a class="hyperlink-button" target="_blank" href="' . $meta . '">Read</a>';
} }
@ -529,21 +487,29 @@ function omphaloskepsis_the_content( $content ) {
$links = $links . '<a class="hyperlink-button" target="_blank" href="' . $meta . '">Licence</a>'; $links = $links . '<a class="hyperlink-button" target="_blank" href="' . $meta . '">Licence</a>';
} }
return $content . $links; return $content . $links;
} elseif ( $post->post_type == 'other' ) { } elseif ( 'other' === $post->post_type ) {
if ( $meta = get_post_meta( $post->ID, 'Link', true ) ) { if ( $meta = get_post_meta( $post->ID, 'Link', true ) ) {
$links = $links . '<a class="hyperlink-button" target="_blank" href="' . $meta . '">Download</a>'; $links = $links . '<a class="hyperlink-button" target="_blank" href="' . $meta . '">Download</a>';
} }
return $content . $links; return $content . $links;
} }
// phpcs:enable
return $content; return $content;
} }
add_filter( 'the_content', 'omphaloskepsis_the_content', 10 ); add_filter( 'the_content', 'omphaloskepsis_the_content', 10 );
// phpcs:disable Squiz.Commenting.FunctionComment.Missing
add_action( 'wp_enqueue_scripts', 'load_dashicons_front_end' ); add_action( 'wp_enqueue_scripts', 'load_dashicons_front_end' );
function load_dashicons_front_end() { function load_dashicons_front_end() {
wp_enqueue_style( 'dashicons' ); wp_enqueue_style( 'dashicons' );
} }
// phpcs:enable
/**
* Display a table of all the available organisations.
*
* @return void
*/
function display_companies() { function display_companies() {
echo '<tr>'; echo '<tr>';
echo '<th colspan="2">Organisation</th>'; echo '<th colspan="2">Organisation</th>';
@ -551,26 +517,29 @@ function display_companies() {
echo '<th>Associated Items</th>'; echo '<th>Associated Items</th>';
echo '</tr>'; echo '</tr>';
// phpcs:disable WordPress.Security.NonceVerification.Missing
// phpcs:disable WordPress.PHP.YodaConditions.NotYoda
// phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotValidated
if ( $_POST['toplevel'] == 'true' ) { if ( $_POST['toplevel'] == 'true' ) {
// Gets all of the top-level company terms. // Gets all of the top-level company terms.
$terms = apply_filters( $terms = apply_filters(
'taxonomy-images-get-terms', 'taxonomy-images-get-terms',
'', '',
array( array(
'having_images' => false, 'having_images' => false,
'taxonomy' => 'company', 'taxonomy' => 'company',
'term_args' => array( 'parent' => 0 ), 'term_args' => array( 'parent' => 0 ),
) )
); );
$include = 1; $include = 1;
} else { } else {
// Gets all of the company terms. // Gets all of the company terms.
$terms = apply_filters( $terms = apply_filters(
'taxonomy-images-get-terms', 'taxonomy-images-get-terms',
'', '',
array( array(
'having_images' => false, 'having_images' => false,
'taxonomy' => 'company', 'taxonomy' => 'company',
) )
); );
$include = 0; $include = 0;
@ -589,30 +558,30 @@ function display_companies() {
// 6 = Others // 6 = Others
// 7 = Qualifications // 7 = Qualifications
// 8 = Awards // 8 = Awards
$post_types = array( 'job', 'post', 'website', 'program', 'writing', 'video', 'other', 'qualification', 'award' ); $post_types = array( 'job', 'post', 'website', 'program', 'writing', 'video', 'other', 'qualification', 'award' );
$dashicons = array( 'hammer', 'admin-post', 'schedule', 'desktop', 'format-aside', 'video-alt', 'archive', 'id', 'awards' ); $dashicons = array( 'hammer', 'admin-post', 'schedule', 'desktop', 'format-aside', 'video-alt', 'archive', 'id', 'awards' );
$term_items = array(); $term_items = array();
$term_item_counts = array(); $term_item_counts = array();
foreach ( $post_types as $post_type ) { foreach ( $post_types as $post_type ) {
$args = array( $args = array(
'posts_per_page' => -1, 'posts_per_page' => -1,
'post_type' => $post_type, 'post_type' => $post_type,
'tax_query' => array( 'tax_query' => array(
array( array(
'taxonomy' => 'company', 'taxonomy' => 'company',
'field' => 'slug', 'field' => 'slug',
'terms' => $term->slug, 'terms' => $term->slug,
'include_children' => $include, 'include_children' => $include,
), ),
), ),
'meta_query' => array(), 'meta_query' => array(),
); );
if ( $_POST['currentjobs'] == 'true' && $post_type == 'job' ) { if ( $_POST['currentjobs'] == 'true' && $post_type == 'job' ) {
$args['meta_query'] = array( $args['meta_query'] = array(
array( array(
'key' => 'end-date', 'key' => 'end-date',
'compare' => 'NOT EXISTS', 'compare' => 'NOT EXISTS',
'value' => '1', 'value' => '1',
), ),
@ -622,7 +591,7 @@ function display_companies() {
if ( $_POST['showexpired'] != 'true' && $post_type == 'qualification' ) { if ( $_POST['showexpired'] != 'true' && $post_type == 'qualification' ) {
$args['meta_query'] = array( $args['meta_query'] = array(
array( array(
'key' => 'Expired', 'key' => 'Expired',
'compare' => 'NOT EXISTS', 'compare' => 'NOT EXISTS',
'value' => '1', 'value' => '1',
), ),
@ -644,85 +613,58 @@ function display_companies() {
( $_POST['other'] == 'true' && $term_item_counts[6] > 0 ) || ( $_POST['other'] == 'true' && $term_item_counts[6] > 0 ) ||
( $_POST['qualification'] == 'true' && $term_item_counts[7] > 0 ) || ( $_POST['qualification'] == 'true' && $term_item_counts[7] > 0 ) ||
( $_POST['award'] == 'true' && $term_item_counts[8] > 0 ) ) { ( $_POST['award'] == 'true' && $term_item_counts[8] > 0 ) ) {
$imgURL = wp_get_attachment_image_src( $term->image_id, 'full' )[0]; $img_url = wp_get_attachment_image_src( $term->image_id, 'full' )[0];
$bgImg = ( ! $imgURL ) ? '' : ' background-image: url(' . strtok( $imgURL, '?' ) . ');'; $bg_img = ( ! $img_url ) ? '' : ' background-image: url(' . strtok( $img_url, '?' ) . ');';
$colour = get_term_meta( $term->term_id, 'color', true ); $colour = get_term_meta( $term->term_id, 'color', true );
$colour = ( $colour != '' ) ? $colour : 'transparent'; $colour = ( $colour != '' ) ? $colour : 'transparent';
echo '<tr class="organisation">'; echo '<tr class="organisation">';
echo '<td class="organisation-logo">'; echo '<td class="organisation-logo">';
echo '<a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">'; echo '<a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">';
echo '<img style="background-color: ' . $colour . ';" src="' . strtok( $imgURL, '?' ) . '" alt="' . $term->name . ' logo">'; echo wp_kses_post( '<img style="background-color: ' . $colour . ';" src="' . strtok( $img_url, '?' ) . '" alt="' . $term->name . ' logo">' );
echo '</a>'; echo '</a>';
echo '</td>'; echo '</td>';
echo '<td class="organisation-name">'; echo '<td class="organisation-name">';
echo '<a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">'; echo '<a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">';
echo '<p>' . $term->name . '</p>'; echo wp_kses_post( '<p>' . $term->name . '</p>' );
echo '</a>'; echo '</a>';
echo '</td>'; echo '</td>';
echo '<td class="organisation-items organisation-children">'; echo '<td class="organisation-items organisation-children">';
$num = ( count( $term_children ) > 0 ) ? '' : 'none'; $num = ( count( $term_children ) > 0 ) ? '' : 'none';
echo '<div class="organisation-item ' . $num . '">'; echo '<div class="organisation-item ' . esc_attr( $num ) . '">';
echo '<span class="dashicons dashicons-groups"></span><br>' . count( $term_children ); echo wp_kses_post( '<span class="dashicons dashicons-groups"></span><br>' . count( $term_children ) );
echo '</div>'; echo '</div>';
echo '</td>'; echo '</td>';
echo '<td class="organisation-items">'; echo '<td class="organisation-items">';
$i = 0; $i = 0;
foreach ( $post_types as $post_type ) { foreach ( $post_types as $post_type ) {
$num = ( $term_item_counts[ $i ] > 0 ) ? '' : 'none'; $num = ( $term_item_counts[ $i ] > 0 ) ? '' : 'none';
echo '<div class="organisation-item ' . $num . '">'; echo '<div class="organisation-item ' . esc_attr( $num ) . '">';
echo '<span class="dashicons dashicons-' . $dashicons[ $i ] . '"></span><br>' . $term_item_counts[ $i ]; echo wp_kses_post( '<span class="dashicons dashicons-' . esc_attr( $dashicons[ $i ] ) . '"></span><br>' . $term_item_counts[ $i ] );
echo '</div>'; echo '</div>';
$i++; $i++;
}; };
echo '</td>'; echo '</td>';
echo '</tr>'; echo '</tr>';
/*
echo '<a href="'.esc_url(get_term_link($term, $term->taxonomy)).'">';
echo '<li class="col-2 col-m-4" style="background-color: '.$colour.'; '.$bgImg.'">';
echo '<div class="company-info-container left">';
if (count($term_children) > 0) {
echo '<div class="company-info children">';
echo count($term_children).'<br><span class="dashicons dashicons-groups"></span>';
echo '</div>';
}
echo '</div>';
echo '<div class="company-info-container right">';
$i = 0;
foreach ($post_types as $post_type) {
if ($_POST[$post_type] == "true") {
echo '<div class="company-info jobs">';
echo $term_item_counts[$i].'<span class="dashicons dashicons-'.$dashicons[$i].'"></span>';
echo '</div>';
}
$i++;
}
echo '</div>';
if (!$imgURL) echo '<p class="company-name">'.$term->name.'</p>';
echo '</li>';
echo '</a>';
*/
} }
} }
} else { } else {
echo '<p>No companies found</p>'; echo '<p>No companies found</p>';
} }
// phpcs:enable
die(); die();
} }
add_action( 'wp_ajax_display_companies', 'display_companies' ); add_action( 'wp_ajax_display_companies', 'display_companies' );
add_action( 'wp_ajax_nopriv_display_companies', 'display_companies' ); add_action( 'wp_ajax_nopriv_display_companies', 'display_companies' );
// allow html in category and taxonomy descriptions // allow HTML in category and taxonomy descriptions.
remove_filter( 'pre_term_description', 'wp_filter_kses' ); remove_filter( 'pre_term_description', 'wp_filter_kses' );
remove_filter( 'pre_link_description', 'wp_filter_kses' ); remove_filter( 'pre_link_description', 'wp_filter_kses' );
remove_filter( 'pre_link_notes', 'wp_filter_kses' ); remove_filter( 'pre_link_notes', 'wp_filter_kses' );
remove_filter( 'term_description', 'wp_kses_data' ); remove_filter( 'term_description', 'wp_kses_data' );
// honour user DNT header // honour user DNT header.
add_filter( 'jetpack_honor_dnt_header_for_stats', '__return_true' ); add_filter( 'jetpack_honor_dnt_header_for_stats', '__return_true' );

View file

@ -1,11 +1,11 @@
<?php <?php
/** /**
* The template for displaying the header. * The template for displaying the header.
* *
* @package WordPress * @package Omphaloskepsis
* @subpackage Omphaloskepsis * @since Omphaloskepsis 1.0
* @since Omphaloskepsis 1.0 */
*/
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
@ -14,15 +14,17 @@
<meta charset="<?php bloginfo( 'charset' ); ?>"> <meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<?php $index = get_post_meta( get_the_ID(), 'Index', true ); ?> <?php $index = get_post_meta( get_the_ID(), 'Index', true ); ?>
<?php if ( ! ( is_single() && ! is_page() && $index == 'true' ) ) : ?> <?php if ( ! ( is_single() && ! is_page() && $index ) ) : ?>
<meta name="robots" content="noindex"> <meta name="robots" content="noindex">
<?php endif; ?> <?php endif; ?>
<link rel="profile" href="http://gmpg.org/xfn/11"> <link rel="profile" href="http://gmpg.org/xfn/11">
<?php if ( is_singular() && pings_open( get_queried_object() ) ) : ?> <?php if ( is_singular() && pings_open( get_queried_object() ) ) : ?>
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>"> <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<?php endif; ?> <?php endif; ?>
<?php wp_head(); ?> <?php wp_head(); ?>
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script> <?php // phpcs:disable WordPress.WP.EnqueuedResources ?>
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>
<?php // phpcs:enable ?>
</head> </head>
<body <?php body_class(); ?> id="site-wrapper"> <body <?php body_class(); ?> id="site-wrapper">

View file

@ -1,11 +1,11 @@
<?php <?php
/** /**
* The blogroll template file. * The blogroll template file.
* *
* @package WordPress * @package Omphaloskepsis
* @subpackage Omphaloskepsis * @since Omphaloskepsis 1.0
* @since Omphaloskepsis 1.0 */
*/
?> ?>
<?php get_header(); ?> <?php get_header(); ?>
@ -15,12 +15,14 @@
<h1>Blog.</h1> <h1>Blog.</h1>
<h2><strong>All</strong> / <a href="/category/thoughts">Thoughts</a> / <a href="/category/reports">Reports</a> / <a href="/category/reviews">Reviews</a> / <a href="/category/projects">Projects</a></h2> <h2><strong>All</strong> / <a href="/category/thoughts">Thoughts</a> / <a href="/category/reports">Reports</a> / <a href="/category/reviews">Reviews</a> / <a href="/category/projects">Projects</a></h2>
<?php <?php
echo get_the_posts_pagination( echo wp_kses_post(
array( get_the_posts_pagination(
'screen_reader_text' => ' ', array(
'mid_size' => 20, 'screen_reader_text' => ' ',
'prev_text' => '', 'mid_size' => 20,
'next_text' => '', 'prev_text' => '',
'next_text' => '',
)
) )
); );
?> ?>
@ -32,7 +34,7 @@
// Start the loop. // Start the loop.
while ( have_posts() ) : while ( have_posts() ) :
the_post(); the_post();
/* /**
* Include the Post-Format-specific template for the content. * Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file * If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead. * called content-___.php (where ___ is the Post Format name) and that will be used instead.
@ -49,18 +51,18 @@
<footer> <footer>
<?php <?php
echo get_the_posts_pagination( echo wp_kses_post(
array( get_the_posts_pagination(
'screen_reader_text' => ' ', array(
'mid_size' => 20, 'screen_reader_text' => ' ',
'prev_text' => '', 'mid_size' => 20,
'next_text' => '', 'prev_text' => '',
'next_text' => '',
)
) )
); );
?> ?>
</footer> </footer>
</main><!-- .content-area --> </main><!-- .content-area -->
<?php // get_sidebar(); ?>
<?php get_footer(); ?> <?php get_footer(); ?>

View file

@ -1,75 +0,0 @@
<?php
/**
* Twenty Sixteen back compat functionality
*
* Prevents Twenty Sixteen from running on WordPress versions prior to 4.4,
* since this theme is not meant to be backward compatible beyond that and
* relies on many newer functions and markup changes introduced in 4.4.
*
* @package WordPress
* @subpackage Twenty_Sixteen
* @since Twenty Sixteen 1.0
*/
/**
* Prevent switching to Twenty Sixteen on old versions of WordPress.
*
* Switches to the default theme.
*
* @since Twenty Sixteen 1.0
*/
function twentysixteen_switch_theme() {
switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME );
unset( $_GET['activated'] );
add_action( 'admin_notices', 'twentysixteen_upgrade_notice' );
}
add_action( 'after_switch_theme', 'twentysixteen_switch_theme' );
/**
* Adds a message for unsuccessful theme switch.
*
* Prints an update nag after an unsuccessful attempt to switch to
* Twenty Sixteen on WordPress versions prior to 4.4.
*
* @since Twenty Sixteen 1.0
*
* @global string $wp_version WordPress version.
*/
function twentysixteen_upgrade_notice() {
$message = sprintf( __( 'Twenty Sixteen requires at least WordPress version 4.4. You are running version %s. Please upgrade and try again.', 'twentysixteen' ), $GLOBALS['wp_version'] );
printf( '<div class="error"><p>%s</p></div>', $message );
}
/**
* Prevents the Customizer from being loaded on WordPress versions prior to 4.4.
*
* @since Twenty Sixteen 1.0
*
* @global string $wp_version WordPress version.
*/
function twentysixteen_customize() {
wp_die(
sprintf( __( 'Twenty Sixteen requires at least WordPress version 4.4. You are running version %s. Please upgrade and try again.', 'twentysixteen' ), $GLOBALS['wp_version'] ),
'',
array(
'back_link' => true,
)
);
}
add_action( 'load-customize.php', 'twentysixteen_customize' );
/**
* Prevents the Theme Preview from being loaded on WordPress versions prior to 4.4.
*
* @since Twenty Sixteen 1.0
*
* @global string $wp_version WordPress version.
*/
function twentysixteen_preview() {
if ( isset( $_GET['preview'] ) ) {
wp_die( sprintf( __( 'Twenty Sixteen requires at least WordPress version 4.4. You are running version %s. Please upgrade and try again.', 'twentysixteen' ), $GLOBALS['wp_version'] ) );
}
}
add_action( 'template_redirect', 'twentysixteen_preview' );

File diff suppressed because it is too large Load diff

View file

@ -1,273 +0,0 @@
<?php
/**
* Custom Twenty Sixteen template tags
*
* Eventually, some of the functionality here could be replaced by core features.
*
* @package WordPress
* @subpackage Twenty_Sixteen
* @since Twenty Sixteen 1.0
*/
if ( ! function_exists( 'twentysixteen_entry_meta' ) ) :
/**
* Prints HTML with meta information for the categories, tags.
*
* Create your own twentysixteen_entry_meta() function to override in a child theme.
*
* @since Twenty Sixteen 1.0
*/
function twentysixteen_entry_meta() {
if ( 'post' === get_post_type() ) {
$author_avatar_size = apply_filters( 'twentysixteen_author_avatar_size', 49 );
printf(
'<span class="byline"><span class="author">%1$s<a class="url fn n" href="%3$s">%4$s</a></span></span>',
get_avatar( get_the_author_meta( 'user_email' ), $author_avatar_size ),
_x( 'Author', 'Used before post author name.', 'twentysixteen' ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
get_the_author()
);
}
if ( in_array( get_post_type(), array( 'post', 'attachment' ) ) ) {
twentysixteen_entry_date();
}
$format = get_post_format();
if ( current_theme_supports( 'post-formats', $format ) ) {
printf(
'<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>',
sprintf( '<span class="screen-reader-text">%s </span></div>', _x( 'Format', 'Used before post format.', 'twentysixteen' ) ),
esc_url( get_post_format_link( $format ) ),
get_post_format_string( $format )
);
}
edit_post_link(
sprintf(
/* translators: %s: Name of current post */
__( 'Edit', 'twentysixteen' ),
get_the_title()
),
'<span class="edit-link">',
'</span>'
);
}
endif;
if ( ! function_exists( 'twentysixteen_entry_date' ) ) :
/**
* Prints HTML with date information for current post.
*
* Create your own twentysixteen_entry_date() function to override in a child theme.
*
* @since Twenty Sixteen 1.0
*/
function twentysixteen_entry_date() {
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
}
$time_string = sprintf(
$time_string,
esc_attr( get_the_date( 'c' ) ),
get_the_date(),
esc_attr( get_the_modified_date( 'c' ) ),
get_the_modified_date()
);
printf(
'<span class="posted-on"><a href="%2$s" rel="bookmark">%3$s</a></span>',
_x( 'Posted on', 'Used before publish date.', 'bengoldsworthy' ),
esc_url( get_permalink() ),
$time_string
);
}
endif;
if ( ! function_exists( 'twentysixteen_entry_taxonomies' ) ) :
/**
* Prints HTML with category and tags for current post.
*
* Create your own twentysixteen_entry_taxonomies() function to override in a child theme.
*
* @since Twenty Sixteen 1.0
*/
function twentysixteen_entry_taxonomies() {
$categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentysixteen' ) );
if ( $categories_list && twentysixteen_categorized_blog() ) {
printf(
'<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
_x( 'Categories', 'Used before category names.', 'twentysixteen' ),
$categories_list
);
}
$tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'twentysixteen' ) );
if ( $tags_list ) {
printf(
'<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
_x( 'Tags', 'Used before tag names.', 'twentysixteen' ),
$tags_list
);
}
}
endif;
if ( ! function_exists( 'twentysixteen_post_thumbnail' ) ) :
/**
* Displays an optional post thumbnail.
*
* Wraps the post thumbnail in an anchor element on index views, or a div
* element when on single views.
*
* Create your own twentysixteen_post_thumbnail() function to override in a child theme.
*
* @since Twenty Sixteen 1.0
*/
function twentysixteen_post_thumbnail() {
if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {
return;
}
if ( is_singular() ) :
?>
<div class="post-header-image">
<div class="post-title"><?php the_title( '<h2 class="title">', '</h2>' ); ?></div>
<?php the_post_thumbnail(); ?>
</div><!-- .post-thumbnail -->
<?php else : ?>
<!--<a class="post-thumbnail" href="<?php // the_permalink(); ?>" aria-hidden="true">
<div class="read-div">Read</div>
<?php // the_post_thumbnail( 'post-thumbnail', array( 'alt' => the_title_attribute( 'echo=0' ) ) ); ?>
</a>-->
<a class="post-thumbnail" href="<?php the_permalink(); ?>" aria-hidden="true">
<div class="image-thumbnail" style="background-image: url('<?php the_post_thumbnail_url(); ?>');">
<div class="read-div">Read</div>
<?php // the_post_thumbnail( 'post-thumbnail', array( 'alt' => the_title_attribute( 'echo=0' ) ) ); ?>
</div>
</a>
<?php
endif; // End is_singular()
}
endif;
if ( ! function_exists( 'twentysixteen_excerpt' ) ) :
/**
* Displays the optional excerpt.
*
* Wraps the excerpt in a div element.
*
* Create your own twentysixteen_excerpt() function to override in a child theme.
*
* @since Twenty Sixteen 1.0
*
* @param string $class Optional. Class string of the div element. Defaults to 'entry-summary'.
*/
function twentysixteen_excerpt( $class = 'entry-summary' ) {
$class = esc_attr( $class );
if ( has_excerpt() || is_search() ) :
?>
<div class="<?php echo $class; ?>">
<?php the_excerpt(); ?>
</div><!-- .<?php echo $class; ?> -->
<?php
endif;
}
endif;
if ( ! function_exists( 'twentysixteen_excerpt_more' ) && ! is_admin() ) :
/**
* Replaces "[...]" (appended to automatically generated excerpts) with ... and
* a 'Continue reading' link.
*
* Create your own twentysixteen_excerpt_more() function to override in a child theme.
*
* @since Twenty Sixteen 1.0
*
* @return string 'Continue reading' link prepended with an ellipsis.
*/
function twentysixteen_excerpt_more() {
$link = sprintf(
'<a href="%1$s" class="more-link">%2$s</a>',
esc_url( get_permalink( get_the_ID() ) ),
/* translators: %s: Name of current post */
sprintf( __( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentysixteen' ), get_the_title( get_the_ID() ) )
);
return ' &hellip; ' . $link;
}
add_filter( 'excerpt_more', 'twentysixteen_excerpt_more' );
endif;
/**
* Determines whether blog/site has more than one category.
*
* Create your own twentysixteen_categorized_blog() function to override in a child theme.
*
* @since Twenty Sixteen 1.0
*
* @return bool True if there is more than one category, false otherwise.
*/
function twentysixteen_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'twentysixteen_categories' ) ) ) {
// Create an array of all the categories that are attached to posts.
$all_the_cool_cats = get_categories(
array(
'fields' => 'ids',
// We only need to know if there is more than one category.
'number' => 2,
)
);
// Count the number of categories that are attached to the posts.
$all_the_cool_cats = count( $all_the_cool_cats );
set_transient( 'twentysixteen_categories', $all_the_cool_cats );
}
if ( $all_the_cool_cats > 1 ) {
// This blog has more than 1 category so twentysixteen_categorized_blog should return true.
return true;
} else {
// This blog has only 1 category so twentysixteen_categorized_blog should return false.
return false;
}
}
/**
* Flushes out the transients used in twentysixteen_categorized_blog().
*
* @since Twenty Sixteen 1.0
*/
function twentysixteen_category_transient_flusher() {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
// Like, beat it. Dig?
delete_transient( 'twentysixteen_categories' );
}
add_action( 'edit_category', 'twentysixteen_category_transient_flusher' );
add_action( 'save_post', 'twentysixteen_category_transient_flusher' );
if ( ! function_exists( 'twentysixteen_the_custom_logo' ) ) :
/**
* Displays the optional custom logo.
*
* Does nothing if the custom logo is not available.
*
* @since Twenty Sixteen 1.2
*/
function twentysixteen_the_custom_logo() {
if ( function_exists( 'the_custom_logo' ) ) {
the_custom_logo();
}
}
endif;

View file

@ -2,10 +2,10 @@
/** /**
* The template file for when no more specific template is found. * The template file for when no more specific template is found.
* *
* @package WordPress * @package Omphaloskepsis
* @subpackage Omphaloskepsis
* @since Omphaloskepsis 1.0 * @since Omphaloskepsis 1.0
*/ */
?> ?>
<?php get_header(); ?> <?php get_header(); ?>

View file

@ -1,5 +1,5 @@
<?php <?php
/* /**
* Template Name: Experience by Companies * Template Name: Experience by Companies
* / * /
@ -9,6 +9,7 @@
* @package Omphaloskepsis * @package Omphaloskepsis
* @since Omphaloskepsis 1.0 * @since Omphaloskepsis 1.0
*/ */
get_header(); ?> get_header(); ?>
<main id="experience-wrapper" class="content-area col-10 col-m-12"> <main id="experience-wrapper" class="content-area col-10 col-m-12">
@ -26,6 +27,7 @@ get_header(); ?>
<div class="entry-content tile" id="settings"> <div class="entry-content tile" id="settings">
<h3 style="margin-bottom: 14px;" class="subheading">Settings</h3> <h3 style="margin-bottom: 14px;" class="subheading">Settings</h3>
<form action="/experience-by-companies" id="settings" method="GET"> <form action="/experience-by-companies" id="settings" method="GET">
<?php wp_nonce_field( 'experience-by-companies' ); ?>
<input class="checkbox" type="checkbox" id="toplevel" value="toplevel" checked="checked"> <input class="checkbox" type="checkbox" id="toplevel" value="toplevel" checked="checked">
<label for="toplevel">Display only top-level organisations</label> <label for="toplevel">Display only top-level organisations</label>
<br> <br>
@ -66,7 +68,7 @@ get_header(); ?>
<!--Company Grid--> <!--Company Grid-->
<table class="row" id="organisations-grid"> <table class="row" id="organisations-grid">
</table> </table>
<?php // phpcs:disable WordPress.WP.EnqueuedResources ?>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script type="text/javascript"> <script type="text/javascript">
@ -132,7 +134,8 @@ get_header(); ?>
}); });
} }
}); });
</script> </script>
<?php // phpcs:disable ?>
</main> </main>
<?php get_footer(); ?> <?php get_footer(); ?>

View file

@ -1,5 +1,5 @@
<?php <?php
/* /**
* Template Name: Experience Timeline * Template Name: Experience Timeline
* / * /
@ -9,138 +9,150 @@
* @package Omphaloskepsis * @package Omphaloskepsis
* @since Omphaloskepsis 1.0 * @since Omphaloskepsis 1.0
*/ */
get_header(); ?> get_header(); ?>
<?php <?php
function withinDates( $jSDate, $jEDate ) { /**
$endYear = date( 'Y' ); * Calculates wether a role is within the max. and min. dates
$endDate = $endYear . '-12-31'; * for the timeline.
$startDate = ( $endYear - 2 ) . '-01-01'; *
$jEDate = ( ! $jEDate ) ? date( 'Y-m-d' ) : ( ( $jEDate > $endDate ) ? $endDate : $jEDate ); * @param string $role_start_date The role's start date.
return ( ( ( strtotime( $jSDate ) < strtotime( $endDate ) ) && ( strtotime( $jSDate ) > strtotime( $startDate ) ) ) && ( strtotime( $jEDate ) > strtotime( $startDate ) ) ); * @param string $role_end_date The role's end date.
} * @return bool
*/
function within_dates( $role_start_date, $role_end_date ) {
$end_year = gmdate( 'Y' );
$end_date = $end_year . '-12-31';
$start_date = ( $end_year - 2 ) . '-01-01';
$role_end_date = ( ! $role_end_date ) ? gmdate( 'Y-m-d' ) : ( ( $role_end_date > $end_date ) ? $end_date : $role_end_date );
return ( ( ( strtotime( $role_start_date ) < strtotime( $end_date ) ) && ( strtotime( $role_start_date ) > strtotime( $start_date ) ) ) && ( strtotime( $role_end_date ) > strtotime( $start_date ) ) );
}
$args = array( $args = array(
'post_type' => array( 'post_type' => array(
'job', 'job',
), ),
'posts_per_page' => -1, 'posts_per_page' => -1,
); );
$loop = new WP_Query( $args ); $loop = new WP_Query( $args );
?> ?>
<main id="experience-wrapper" class="content-area col-10 col-m-12"> <main id="experience-wrapper" class="content-area col-10 col-m-12">
<header class="post-header-title"> <header class="post-header-title">
<h1 id="page-title">Experience</h1> <h1 id="page-title">Experience</h1>
<h2 id="page-subtitle">or, a brief history of Ben</h2> <h2 id="page-subtitle">or, a brief history of Ben</h2>
<?php <?php
while ( have_posts() ) : while ( have_posts() ) :
the_post(); the_post();
?> ?>
<div class="entry-content tile" id="taxonomy-description"> <div class="entry-content tile" id="taxonomy-description">
<?php the_content(); ?> <?php the_content(); ?>
</div> </div>
<div class="entry-content tile" id="settings"> <div class="entry-content tile" id="settings">
<h3 style="margin-bottom: 14px;" class="subheading">Settings</h3> <h3 style="margin-bottom: 14px;" class="subheading">Settings</h3>
<form action="/experience-timeline" id="settings" method="GET"> <form action="/experience-timeline" id="settings" method="GET">
<input class="checkbox" type="checkbox" id="separate" value="separate" checked="checked"> <input class="checkbox" type="checkbox" id="separate" value="separate" checked="checked">
<label for="separate">Separate past and current roles</label> <label for="separate">Separate past and current roles</label>
<input class="ui-button ui-widget ui-corner-all" id="refresh" type="submit" value="Refresh"> <input class="ui-button ui-widget ui-corner-all" id="refresh" type="submit" value="Refresh">
</form> </form>
</div> </div>
<?php endwhile; ?> <?php endwhile; ?>
</header> </header>
<div id="primary" class="content-area"> <div id="primary" class="content-area">
<main id="company-main" class="site-main" role="main"> <main id="company-main" class="site-main" role="main">
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <?php // phpcs:disable WordPress.WP.EnqueuedResources ?>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script type="text/javascript"> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
jQuery(document).ready(function($) { <script type="text/javascript">
$('input:checkbox').checkboxradio(); jQuery(document).ready(function($) {
$('.refresh').button(); $('input:checkbox').checkboxradio();
$('.refresh').button();
google.charts.load('current', {'packages':['timeline']}); google.charts.load('current', {'packages':['timeline']});
google.charts.setOnLoadCallback(drawChart); google.charts.setOnLoadCallback(drawChart);
$('input[type="checkbox"]').change(function() { $('input[type="checkbox"]').change(function() {
alert("Feature in progress"); alert("Feature in progress");
$('#refresh').css('border-width', '5px'); $('#refresh').css('border-width', '5px');
}); });
$('#refresh').click(function(event) { $('#refresh').click(function(event) {
$(this).css('border-width', '1px'); $(this).css('border-width', '1px');
event.preventDefault(); event.preventDefault();
drawChart(); drawChart();
}); });
}); });
function drawChart() { function drawChart() {
var container = document.getElementById('timeline'); var container = document.getElementById('timeline');
var chart = new google.visualization.Timeline(container); var chart = new google.visualization.Timeline(container);
var dataTable = new google.visualization.DataTable(); var dataTable = new google.visualization.DataTable();
dataTable.addColumn({ type: 'string', id: 'Type' }); dataTable.addColumn({ type: 'string', id: 'Type' });
dataTable.addColumn({ type: 'string', id: 'Role' }); dataTable.addColumn({ type: 'string', id: 'Role' });
dataTable.addColumn({ type: 'string', role: 'tooltip', 'p': {'html': true} }); dataTable.addColumn({ type: 'string', role: 'tooltip', 'p': {'html': true} });
dataTable.addColumn({ type: 'date', id: 'Start' }); dataTable.addColumn({ type: 'date', id: 'Start' });
dataTable.addColumn({ type: 'date', id: 'End' }); dataTable.addColumn({ type: 'date', id: 'End' });
dataTable.addRows([ dataTable.addRows([
<?php <?php
while ( $loop->have_posts() ) : while ( $loop->have_posts() ) :
$loop->the_post(); $loop->the_post();
?> ?>
<?php <?php
$endDate = get_post_meta( get_the_ID(), 'end-date', true ); $end_date = get_post_meta( get_the_ID(), 'end-date', true );
$isCurrent = ( ! $endDate || ( $endDate && $endDate > date('Y-m-d') ) ) ? true : false; $is_current = ( ! $end_date || ( $end_date && $end_date > gmdate( 'Y-m-d' ) ) ) ? true : false;
$company = wp_get_object_terms( $company = wp_get_object_terms(
get_the_ID(), get_the_ID(),
'company', 'company',
array( array(
'fields' => 'names', 'fields' => 'names',
) )
); );
$title = htmlspecialchars_decode(strip_tags( get_the_title() )); $role_title = htmlspecialchars_decode( strip_tags( get_the_title() ) );
$start = get_the_date(); $start = get_the_date();
$end = ( ! $endDate || ( $endDate && $endDate > date('Y-m-d') ) ) ? date( 'Y-m-d' ) : $endDate; $end = ( ! $end_date || ( $end_date && $end_date > gmdate( 'Y-m-d' ) ) ) ? gmdate( 'Y-m-d' ) : $end_date;
?> ?>
[ [
'<?php echo ( $isCurrent ) ? 'Current' : 'Past'; ?>', '<?php echo ( $is_current ) ? 'Current' : 'Past'; ?>',
'<?php echo $title . ', ' . html_entity_decode( $company[0] ); ?>', '<?php echo esc_html( $role_title . ', ' . html_entity_decode( $company[0] ) ); ?>',
'<div style="padding: 20px"><h1 class="timeline-entry-title"><?php echo $title; ?></h1><h2><?php echo html_entity_decode( $company[0] ); ?></h2><ul><li><?php echo $start; ?>&mdash;<?php echo ( $isCurrent ) ? 'present' : $end; ?></li></ul></div>', '<div style="padding: 20px"><h1 class="timeline-entry-title"><?php echo wp_kses_post( $role_title ); ?></h1><h2><?php echo wp_kses_post( html_entity_decode( $company[0] ) ); ?></h2><ul><li><?php echo esc_html( $start ); ?>&mdash;<?php echo esc_html( ( $is_current ) ? 'present' : $end ); ?></li></ul></div>',
new Date('<?php echo $start; ?>'), new Date('<?php echo esc_attr( $start ); ?>'),
new Date('<?php echo $end; ?>') new Date('<?php echo esc_attr( $end ); ?>')
], ],
<?php endwhile; ?> <?php endwhile; ?>
]); ]);
var rowHeight = 15; var rowHeight = 15;
var chartHeight = dataTable.getNumberOfRows() * rowHeight + 50; var chartHeight = dataTable.getNumberOfRows() * rowHeight + 50;
var options = { var options = {
tooltip: {isHtml: true}, tooltip: {isHtml: true},
timeline: { timeline: {
showRowLabels: true, showRowLabels: true,
}, },
height: chartHeight, height: chartHeight,
width: window.innerWidth - 200, width: window.innerWidth - 200,
}; };
chart.draw(dataTable, options); chart.draw(dataTable, options);
} }
</script> </script>
<?php // phpcs:disable ?>
<div id="slider-range"></div> <div id="slider-range"></div>
<section id="timeline"> <section id="timeline">
<div class="row"> <div class="row">
<div id="timeline" class="col-12"> <div id="timeline" class="col-12">
<img class="loading" src="/wp-content/uploads/2016/12/ajax-loader.gif"> <img class="loading" src="/wp-content/uploads/2016/12/ajax-loader.gif">
</div> </div>
</div> </div>
</section> </section>
</main> </main>
</div> </div>
</main> </main>
<?php // get_sidebar(); ?> <?php // get_sidebar(); ?>

View file

@ -2,10 +2,10 @@
/** /**
* The template for displaying pages. * The template for displaying pages.
* *
* @package WordPress * @package Omphaloskepsis
* @subpackage Omphaloskepsis
* @since Omphaloskepsis 1.0 * @since Omphaloskepsis 1.0
*/ */
?> ?>
<?php get_header(); ?> <?php get_header(); ?>

View file

@ -2,25 +2,25 @@
/** /**
* The template for the sidebar. * The template for the sidebar.
* *
* @package WordPress * @package Omphaloskepsis
* @subpackage Omphaloskepsis
* @since Omphaloskepsis 1.0 * @since Omphaloskepsis 1.0
*/ */
?> ?>
<nav class="col-2" id="sidebar"> <nav class="col-2" id="sidebar">
<ul id="sidebar-list"> <ul id="sidebar-list">
<li <?php echo $wp->request == 'blog' ? 'class="current"' : ''; ?>> <li <?php echo 'blog' === $wp->request ? 'class="current"' : ''; ?>>
<a href="/blog">Blog</a> <a href="/blog">Blog</a>
<a href="/feed"><i class="fa fa-rss"></i></a> <a href="/feed"><i class="fa fa-rss"></i></a>
</li> </li>
<li><p>~</p></li> <li><p>~</p></li>
<li <?php echo $wp->request == 'website' ? 'class="current"' : ''; ?>><a href="/website">Websites</a></li> <li <?php echo 'website' === $wp->request ? 'class="current"' : ''; ?>><a href="/website">Websites</a></li>
<li <?php echo $wp->request == 'program' ? 'class="current"' : ''; ?>><a href="/program">Programs</a></li> <li <?php echo 'program' === $wp->request ? 'class="current"' : ''; ?>><a href="/program">Programs</a></li>
<li <?php echo $wp->request == 'writing' ? 'class="current"' : ''; ?>><a href="/writing">Writings</a></li> <li <?php echo 'writing' === $wp->request ? 'class="current"' : ''; ?>><a href="/writing">Writings</a></li>
<li <?php echo $wp->request == 'video' ? 'class="current"' : ''; ?>><a href="/video">Videos</a></li> <li <?php echo 'video' === $wp->request ? 'class="current"' : ''; ?>><a href="/video">Videos</a></li>
<li <?php echo $wp->request == 'other' ? 'class="current"' : ''; ?>><a href="/other">Other</a></li> <li <?php echo 'other' === $wp->request ? 'class="current"' : ''; ?>><a href="/other">Other</a></li>
<li><p>~</p></li> <li><p>~</p></li>
<li <?php echo $wp->request == 'experience' ? 'class="current"' : ''; ?>><a href="/experience">Experience (by organisation)</a></li> <li <?php echo 'experience' === $wp->request ? 'class="current"' : ''; ?>><a href="/experience">Experience (by organisation)</a></li>
</ul> </ul>
</nav> </nav>

View file

@ -2,10 +2,10 @@
/** /**
* The template for displaying all single Pages. * The template for displaying all single Pages.
* *
* @package WordPress * @package Omphaloskepsis
* @subpackage Omphaloskepsis
* @since Omphaloskepsis 1.0 * @since Omphaloskepsis 1.0
*/ */
?> ?>
<?php get_header(); ?> <?php get_header(); ?>

View file

@ -606,6 +606,7 @@ html {
body > footer { body > footer {
grid-area: footer; grid-area: footer;
margin-top: 1em;
} }
} }
@ -1134,6 +1135,24 @@ article.tile > header > h2 {
font-size: 0.8em; font-size: 0.8em;
} }
a[href*="//"]:not([href*="bengoldsworthy.net"]):after {
content: url('https://upload.wikimedia.org/wikipedia/commons/6/64/Icon_External_Link.png');
margin: 0 0 0 4px;
filter: invert(0%) sepia(0%) saturate(15%) hue-rotate(246deg) brightness(104%) contrast(98%);
}
a[href*="//"].item:not([href*="bengoldsworthy.net"]):after {
position: relative;
top: -1em;
float: right;
}
a[href="#"],
a[href=""] {
color: red;
}
a { a {
opacity: 0.8; opacity: 0.8;
text-decoration: underline !important; text-decoration: underline !important;
@ -1429,14 +1448,3 @@ summary {
font-size: 1.1em; font-size: 1.1em;
font-weight: bold; font-weight: bold;
} }
/* shorter version!
a[href*="//"]:not([href*="bengoldsworthy.net"]):after {
content: url('./icons/extlink.svg');
margin: 0 0 0 5px;
}
a[href="#"] {
color: red;
}
*/

View file

@ -5,6 +5,7 @@
* @package Omphaloskepsis * @package Omphaloskepsis
* @since Omphaloskepsis 1.0 * @since Omphaloskepsis 1.0
*/ */
?> ?>
<?php get_header(); ?> <?php get_header(); ?>
@ -12,10 +13,10 @@
<?php <?php
// Gets all of the roles attached to the given organisation. // Gets all of the roles attached to the given organisation.
$company = get_queried_object(); $company = get_queried_object();
echo '<!-- ' . $company->name . '-->'; echo '<!-- ' . wp_kses_post( $company->name ) . '-->';
$args = array( $args = array(
'post_type' => array( 'job' ), 'post_type' => array( 'job' ),
'tax_query' => array( 'tax_query' => array(
array( array(
'taxonomy' => 'company', 'taxonomy' => 'company',
'field' => 'slug', 'field' => 'slug',
@ -27,7 +28,7 @@
$loop = new WP_Query( $args ); $loop = new WP_Query( $args );
?> ?>
<?php // phpcs:disable WordPress.WP.EnqueuedResources ?>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
@ -52,23 +53,23 @@
$loop->the_post(); $loop->the_post();
// Gets all of the roles associated with this organisation and its // Gets all of the roles associated with this organisation and its
// child organisations. // child organisations.
$companies = wp_get_object_terms( get_the_ID(), 'company' ); $companies = wp_get_object_terms( get_the_ID(), 'company' );
$i = 0; $i = 0;
$currSizeOf = -1; $curr_size_of = -1;
foreach ( $companies as $company ) { foreach ( $companies as $company ) {
if ( sizeof( get_ancestors( $company->term_id, 'company' ) ) > $currSizeOf ) { if ( count( get_ancestors( $company->term_id, 'company' ) ) > $curr_size_of ) {
$currSizeOf = sizeof( get_ancestors( $company->term_id, 'company' ) ); $curr_size_of = count( get_ancestors( $company->term_id, 'company' ) );
$lowestDepthCompany = $i++; $lowest_depth_company = $i++;
} }
} }
$endDate = get_post_meta( get_the_ID(), 'end-date', true ); $end_date = get_post_meta( get_the_ID(), 'end-date', true );
$title = htmlspecialchars_decode(strip_tags( get_the_title() )); $item_title = htmlspecialchars_decode( strip_tags( get_the_title() ) );
$start = get_the_date(); $start = get_the_date();
$end = ( ! $endDate || ( $endDate && $endDate > date('Y-m-d') ) ) ? date( 'Y-m-d' ) : $endDate; $end = ( ! $end_date || ( $end_date && $end_date > gmdate( 'Y-m-d' ) ) ) ? gmdate( 'Y-m-d' ) : $end_date;
echo "[ '" . html_entity_decode( $companies[ $lowestDepthCompany ]->name ) . "', '$title', new Date('$start'), new Date('$end') ],\n"; echo wp_kses_post( "[ '" . html_entity_decode( $companies[ $lowest_depth_company ]->name ) . "', '$item_title', new Date('$start'), new Date('$end') ],\n" );
endwhile; endwhile;
?> ?>
]); ]);
@ -76,40 +77,41 @@
// Draws the table, then resizes the element height and re-draws it // Draws the table, then resizes the element height and re-draws it
// to avoid needing to scroll vertically. // to avoid needing to scroll vertically.
var rowHeight = 15; var rowHeight = 15;
var chartHeight = dataTable.getNumberOfRows() * rowHeight + 50; var chartHeight = dataTable.getNumberOfRows() * rowHeight + 50;
var options = { var options = {
tooltip: {isHtml: true}, tooltip: {isHtml: true},
timeline: { timeline: {
showRowLabels: true, showRowLabels: true,
}, },
height: chartHeight, height: chartHeight,
width: '100%', width: '100%',
}; };
chart.draw(dataTable, options); chart.draw(dataTable, options);
} }
</script> </script>
<?php // phpcs:enable ?>
<main id="split-page" role="main"> <main id="split-page" role="main">
<?php <?php
$companyLogo = apply_filters( 'taxonomy-images-queried-term-image-url', '', array( 'image_size' => 'full' ) ); $company_logo = apply_filters( 'taxonomy-images-queried-term-image-url', '', array( 'image_size' => 'full' ) );
$companyName = get_queried_object()->name; $company_name = get_queried_object()->name;
?> ?>
<div id="wrapper"> <div id="wrapper">
<header style="background-image: url('<?php echo $companyLogo; ?>'); background-color: <?php echo get_term_meta( get_queried_object()->term_id, 'color' )[0]; ?>; background-size: contain;"> <header style="background-image: url('<?php echo esc_url( $company_logo ); ?>'); background-color: <?php echo esc_attr( get_term_meta( get_queried_object()->term_id, 'color' )[0] ); ?>; background-size: contain;">
<div> <div>
<?php <?php
if ( strlen( $companyName ) > 70 ) { if ( strlen( $company_name ) > 70 ) {
$small = '2em'; $small = '2em';
} elseif ( strlen( $companyName ) > 35 ) { } elseif ( strlen( $company_name ) > 35 ) {
$small = '3em'; $small = '3em';
} elseif ( strlen( $companyName ) > 12 ) { } elseif ( strlen( $company_name ) > 12 ) {
$small = '4em'; $small = '4em';
} else { } else {
$small = '5em'; $small = '5em';
} }
?> ?>
<h1 id="post-title" style="font-size: <?php echo $small; ?>;"><?php echo $companyName; ?></h1> <h1 id="post-title" style="font-size: <?php echo esc_attr( $small ); ?>;"><?php echo wp_kses_post( $company_name ); ?></h1>
</div> </div>
</header><!-- .entry-header --> </header><!-- .entry-header -->
@ -120,7 +122,7 @@
<?php if ( $loop->have_posts() ) : ?> <?php if ( $loop->have_posts() ) : ?>
<section id="timeline"> <section id="timeline">
<div id="timeline" class="col-12"> <div id="timeline" class="col-12">
<img class="loading" src="/wp-content/uploads/2016/12/ajax-loader.gif"> <img class="loading" src="/wp-content/uploads/2016/12/ajax-loader.gif">
</div> </div>
</section> </section>
<?php endif; ?> <?php endif; ?>
@ -133,8 +135,8 @@
'', '',
array( array(
'having_images' => false, 'having_images' => false,
'taxonomy' => 'company', 'taxonomy' => 'company',
'term_args' => array( 'term_args' => array(
'include' => get_term_by( 'id', get_queried_object()->parent, 'company' )->term_id, 'include' => get_term_by( 'id', get_queried_object()->parent, 'company' )->term_id,
), ),
) )
@ -147,12 +149,12 @@
<ul class="index"> <ul class="index">
<?php <?php
foreach ( (array) $parents as $parent ) : foreach ( (array) $parents as $parent ) :
$imgURL = wp_get_attachment_image_src( $parent->image_id )[0]; $img_url = wp_get_attachment_image_src( $parent->image_id )[0];
$colour = get_term_meta( $parent->term_id, 'color', true ); $colour = get_term_meta( $parent->term_id, 'color', true );
$colour = ( $colour != '' ) ? $colour : 'transparent'; $colour = ( '' !== $colour ) ? $colour : 'transparent';
?> ?>
<li><a href="<?php echo esc_url( get_term_link( $parent, $parent->taxonomy ) ); ?>"><?php echo get_term( $parent->term_id, 'company' )->name; ?></a></li> <li><a href="<?php echo esc_url( get_term_link( $parent, $parent->taxonomy ) ); ?>"><?php echo wp_kses_post( get_term( $parent->term_id, 'company' )->name ); ?></a></li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
<?php endif; ?> <?php endif; ?>
@ -165,8 +167,8 @@
'', '',
array( array(
'having_images' => false, 'having_images' => false,
'taxonomy' => 'company', 'taxonomy' => 'company',
'term_args' => array( 'parent' => get_queried_object()->term_id ), 'term_args' => array( 'parent' => get_queried_object()->term_id ),
) )
); );
if ( count( $children ) > 0 ) : if ( count( $children ) > 0 ) :
@ -175,12 +177,12 @@
<ul class="index"> <ul class="index">
<?php <?php
foreach ( (array) $children as $child ) : foreach ( (array) $children as $child ) :
$imgURL = wp_get_attachment_image_src( $child->image_id, 'detail' )[0]; $img_url = wp_get_attachment_image_src( $child->image_id, 'detail' )[0];
$colour = get_term_meta( $child->term_id, 'color', true ); $colour = get_term_meta( $child->term_id, 'color', true );
$colour = ( $colour != '' ) ? $colour : 'transparent'; $colour = ( '' !== $colour ) ? $colour : 'transparent';
?> ?>
<li><a href="<?php echo esc_url( get_term_link( $child, $child->taxonomy ) ); ?>"><?php echo get_term( $child->term_id, 'company' )->name; ?></a></li> <li><a href="<?php echo esc_url( get_term_link( $child, $child->taxonomy ) ); ?>"><?php echo wp_kses_post( get_term( $child->term_id, 'company' )->name ); ?></a></li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
<?php else : ?> <?php else : ?>
@ -189,15 +191,15 @@
</div> </div>
</section> </section>
<?php <?php
$pageOrder = array( 'post', 'website', 'program', 'writing', 'video', 'other' ); $page_order = array( 'post', 'website', 'program', 'writing', 'video', 'other' );
foreach ( $pageOrder as $currSec ) { foreach ( $page_order as $current_section ) {
$args['post_type'] = array( $currSec ); $args['post_type'] = array( $current_section );
$i = 0; $i = 0;
$loop = new WP_Query( $args ); $loop = new WP_Query( $args );
if ( $loop->have_posts() ) : if ( $loop->have_posts() ) :
echo '<section id="' . $currSec . '" class="org-items row">'; echo '<section id="' . esc_attr( $current_section ) . '" class="org-items row">';
echo '<h2 class="subheading">' . ucwords( $currSec ) . 's <a href="/' . ( $currSec != 'post' ? $currSec : 'blog' ) . '?company=' . get_queried_object()->slug . '">View all ' . $loop->post_count . '</a></h2>'; echo '<h2 class="subheading">' . wp_kses_post( ucwords( $current_section ) ) . 's <a href="/' . esc_attr( ( 'post' !== $current_section ? $current_section : 'blog' ) ) . '?company=' . esc_attr( get_queried_object()->slug ) . '">View all ' . esc_html( $loop->post_count ) . '</a></h2>';
echo '<div class="index">'; echo '<div class="index">';
while ( ( $loop->have_posts() ) && ( $i++ < 4 ) ) : while ( ( $loop->have_posts() ) && ( $i++ < 4 ) ) :
$loop->the_post(); $loop->the_post();
@ -210,14 +212,14 @@
echo '<section id="quals-and-awards">'; echo '<section id="quals-and-awards">';
echo '<div id="qualifications" class="org-items row">'; echo '<div id="qualifications" class="org-items row">';
$args['post_type'] = 'qualification'; $args['post_type'] = 'qualification';
$loop = new WP_Query( $args ); $loop = new WP_Query( $args );
echo '<h2 class="subheading">Qualifications</h2>'; echo '<h2 class="subheading">Qualifications</h2>';
if ( $loop->have_posts() ) : if ( $loop->have_posts() ) :
echo '<ul class="index">'; echo '<ul class="index">';
while ( $loop->have_posts() ) : while ( $loop->have_posts() ) :
$loop->the_post(); $loop->the_post();
$url = esc_url( get_permalink() ); $url = get_permalink();
echo '<li><a href="' . $url . '">' . get_the_title() . '</a></li>'; echo '<li><a href="' . esc_url( $url ) . '">' . wp_kses_post( get_the_title() ) . '</a></li>';
endwhile; endwhile;
echo '</ul>'; echo '</ul>';
else : else :
@ -227,14 +229,14 @@
echo '<div id="awards" class="org-items row">'; echo '<div id="awards" class="org-items row">';
$args['post_type'] = 'award'; $args['post_type'] = 'award';
$loop = new WP_Query( $args ); $loop = new WP_Query( $args );
echo '<h2 class="subheading">Awards</h2>'; echo '<h2 class="subheading">Awards</h2>';
if ( $loop->have_posts() ) : if ( $loop->have_posts() ) :
echo '<ul class="index">'; echo '<ul class="index">';
while ( $loop->have_posts() ) : while ( $loop->have_posts() ) :
$loop->the_post(); $loop->the_post();
$url = esc_url( get_permalink() ); $url = esc_url( get_permalink() );
echo '<li><a href="' . $url . '">' . get_the_title() . '</a></li>'; echo '<li><a href="' . esc_url( $url ) . '">' . wp_kses_post( get_the_title() ) . '</a></li>';
endwhile; endwhile;
echo '</ul>'; echo '</ul>';
else : else :
@ -244,10 +246,10 @@
echo '</section>'; echo '</section>';
$args['post_type'] = 'appearance'; $args['post_type'] = 'appearance';
$loop = new WP_Query( $args ); $loop = new WP_Query( $args );
if ( $loop->have_posts() ) : if ( $loop->have_posts() ) :
echo '<section id="appearances" class="org-items row">'; echo '<section id="appearances" class="org-items row">';
echo '<h2 class="subheading">Appearances <a href="/appearance?company=' . get_queried_object()->slug . '">View all ' . $loop->post_count . '</a></h2>'; echo '<h2 class="subheading">Appearances <a href="/appearance?company=' . esc_attr( get_queried_object()->slug ) . '">View all ' . esc_html( $loop->post_count ) . '</a></h2>';
echo '<div class="index">'; echo '<div class="index">';
while ( ( $loop->have_posts() ) ) : while ( ( $loop->have_posts() ) ) :
$loop->the_post(); $loop->the_post();
@ -258,10 +260,10 @@
endif; endif;
$args['post_type'] = 'correspondence'; $args['post_type'] = 'correspondence';
$loop = new WP_Query( $args ); $loop = new WP_Query( $args );
if ( $loop->have_posts() ) : if ( $loop->have_posts() ) :
echo '<section id="correspondence" class="org-items row">'; echo '<section id="correspondence" class="org-items row">';
echo '<h2 class="subheading">Correspondence <a href="/correspondence?company=' . get_queried_object()->slug . '">View all ' . $loop->post_count . '</a></h2>'; echo '<h2 class="subheading">Correspondence <a href="/correspondence?company=' . esc_attr( get_queried_object()->slug ) . '">View all ' . esc_html( $loop->post_count ) . '</a></h2>';
echo '<div class="index">'; echo '<div class="index">';
while ( ( $loop->have_posts() ) ) : while ( ( $loop->have_posts() ) ) :
$loop->the_post(); $loop->the_post();

View file

@ -1,33 +1,30 @@
<?php <?php
/** /**
* The template part for displaying a message that posts cannot be found. * The template part for displaying a message that posts cannot be found.
* *
* @package WordPress * @package WordPress
* @subpackage Omphaloskepsis * @subpackage Omphaloskepsis
* @since Omphaloskepsis 1.0 * @since Omphaloskepsis 1.0
*/ */
?> ?>
<section class="no-results not-found"> <section class="no-results not-found">
<header class="page-header"> <header class="page-header">
<h1 class="page-title"><?php _e( 'Nothing Found', 'twentysixteen' ); ?></h1> <h1 class="page-title">Nothing Found</h1>
</header><!-- .page-header --> </header><!-- .page-header -->
<div class="page-content"> <div class="page-content">
<?php if ( is_home() && current_user_can( 'publish_posts' ) ) : ?> <?php if ( is_search() ) : ?>
<p><?php printf( __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'twentysixteen' ), esc_url( admin_url( 'post-new.php' ) ) ); ?></p> <p><?php esc_html_e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'twentysixteen' ); ?></p>
<?php get_search_form(); ?>
<?php elseif ( is_search() ) : ?> <?php else : ?>
<p><?php _e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'twentysixteen' ); ?></p> <p><?php esc_html_e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'twentysixteen' ); ?></p>
<?php get_search_form(); ?> <?php get_search_form(); ?>
<?php else : ?> <?php endif; ?>
</div><!-- .page-content -->
<p><?php _e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'twentysixteen' ); ?></p>
<?php get_search_form(); ?>
<?php endif; ?>
</div><!-- .page-content -->
</section><!-- .no-results --> </section><!-- .no-results -->

View file

@ -1,30 +1,34 @@
<?php <?php
/** /**
* The template used for displaying page content. * The template used for displaying page content.
* *
* @package WordPress * @package WordPress
* @subpackage Twenty_Sixteen * @subpackage Twenty_Sixteen
* @since Twenty Sixteen 1.0 * @since Twenty Sixteen 1.0
*/ */
?> ?>
<article id="wrapper" <?php post_class(); ?>> <article id="wrapper" <?php post_class(); ?>>
<header style="background-image: url('<?php the_post_thumbnail_url(); ?>');"> <header style="background-image: url('<?php the_post_thumbnail_url(); ?>');">
<div> <div>
<h1 id="post-title"><?php echo get_the_title(); ?></h1> <h1 id="post-title"><?php echo esc_html( get_the_title() ); ?></h1>
<?php if ( $subtitle = get_post_meta( get_the_ID(), 'Subtitle', true ) ) : ?> <?php
<h2 id="post-subtitle"><?php echo $subtitle; ?></h2> $subtitle = get_post_meta( get_the_ID(), 'Subtitle', true );
<?php endif; ?> if ( $subtitle ) :
</div> ?>
</header><!-- .entry-header --> <h2 id="post-subtitle"><?php echo esc_html( $subtitle ); ?></h2>
<?php endif; ?>
</div>
</header><!-- .entry-header -->
<main id="page-body" class="body"> <main id="page-body" class="body">
<?php <?php
if ( get_the_content() ) : if ( get_the_content() ) :
the_content(); the_content();
else : else :
echo get_the_excerpt(); echo esc_html( get_the_excerpt() );
endif; endif;
?> ?>
</main><!-- .entry-content --> </main><!-- .entry-content -->
</article><!-- #post-## --> </article><!-- #post-## -->

View file

@ -1,114 +1,201 @@
<?php <?php
/** /**
* The template part for displaying single Posts. * The template part for displaying single Posts.
* *
* @package WordPress * @package Omphaloskepsis
* @subpackage Omphaloskepsis * @since Omphaloskepsis 1.0
* @since Omphaloskepsis 1.0 */
*/
?> ?>
<article id="wrapper" <?php post_class(); ?>> <article id="wrapper" <?php post_class(); ?>>
<header style="background-image: url('<?php the_post_thumbnail_url(); ?>');"> <header style="background-image: url('<?php the_post_thumbnail_url(); ?>');">
<div> <div>
<h1 id="post-title"><?php echo get_the_title(); ?></h1> <h1 id="post-title">
<?php if ( $subtitle = get_post_meta( get_the_ID(), 'Subtitle', true ) ) : ?> <?php echo esc_html( get_the_title() ); ?>
<h2 id="post-subtitle"><?php echo $subtitle; ?></h2> </h1>
<?php endif; ?>
<?php // the_date('F j\<\s\u\p\>S\<\/\s\u\p\>, 1,Y \H\.\E\.', '<h3>', '</h3>'); ?>
</div>
</header><!-- .entry-header -->
<main id="post-body" class="body"> <?php
<?php $date1 = strtotime( get_the_date( 'Y-m-d' ) ); ?> $subtitle = get_post_meta( get_the_ID(), 'Subtitle', true );
<?php $date2 = strtotime( date( 'Y-m-d' ) ); ?> if ( $subtitle ) :
<?php if ( has_category( 'series' ) || has_tag( 'ohwhatohjeez' ) || get_post_meta( get_the_ID(), 'Note(s)', true ) || get_post_meta( get_the_ID(), 'License', true ) || ( $date1 < $date2 - 31557600 ) ) : ?> ?>
<div id="details"> <h2 id="post-subtitle">
<ul> <?php echo wp_kses_post( $subtitle ); ?>
<?php </h2>
<?php endif; ?>
</div>
</header><!-- .entry-header -->
<main id="post-body" class="body">
<?php $date1 = strtotime( get_the_date( 'Y-m-d' ) ); ?>
<?php $date2 = strtotime( gmdate( 'Y-m-d' ) ); ?>
<?php if ( has_category( 'series' ) || has_tag( 'ohwhatohjeez' ) || get_post_meta( get_the_ID(), 'Note(s)', true ) || get_post_meta( get_the_ID(), 'License', true ) || ( $date1 < $date2 - 31557600 ) ) : ?>
<div id="details">
<ul>
<?php
if ( has_category( 'thoughts' ) ) { if ( has_category( 'thoughts' ) ) {
$type = 'thought'; $post_category = 'thought';
} else if ( has_category( 'reports' ) ) { } elseif ( has_category( 'reports' ) ) {
$type = 'report'; $post_category = 'report';
} else if ( has_category( 'review' ) ) { } elseif ( has_category( 'review' ) ) {
$type = 'review'; $post_category = 'review';
} }
if ( has_category( 'series' ) ) { if ( has_category( 'series' ) ) {
$catag = 'is a part of the following series'; $category_text = 'is a part of the following series';
$series = array(); $series = array();
$s = get_category_by_slug( 'series' ); $series_item = get_category_by_slug( 'series' );
$seriesIDs = get_term_children( $s->term_id, 'category' ); $series_ids = get_term_children( $series_item->term_id, 'category' );
foreach ( $seriesIDs as $thisSeriesID ) { foreach ( $series_ids as $this_series_id ) {
if ( has_category( $thisSeriesID ) ) { if ( has_category( $this_series_id ) ) {
array_push( $series, get_category( $thisSeriesID ) ); array_push( $series, get_category( $this_series_id ) );
} }
} }
if ( count( $series ) > 1 ) { if ( count( $series ) > 1 ) {
$catag .= '&rsquo;'; $category_text .= '&rsquo;';
} }
$punct = ':'; $punct = ':';
foreach ( $series as $thisSeries ) { foreach ( $series as $this_series ) {
$catag .= $punct . ' '; $category_text .= $punct . ' ';
if ( $punct == ':' ) { if ( ':' === $punct ) {
$punct = ';'; $punct = ';';
} }
$catag .= '<a href="/category/series/' . $thisSeries->slug . '">' . $thisSeries->name . '</a>'; $category_text .= '<a href="/category/series/' . $this_series->slug . '">' . $this_series->name . '</a>';
} }
$catag .= '.'; $category_text .= '.';
echo '<li>';
echo "<li>This <a href='/category/{$type}s'>{$type}</a> {$catag}</li>"; echo wp_kses_post( "This <a href='/category/$post_category'>$post_category</a> $category_text" );
echo '</li>';
} }
?> ?>
<?php if ( $date1 < $date2 - 31557600 ) : ?> <?php if ( $date1 < $date2 - 31557600 ) : ?>
<li>This piece was written over a year ago. It may no longer accurately reflect my views now, or may be factually outdated.</li> <li>This piece was written over a year ago. It may no longer accurately reflect my views now, or may be factually outdated.</li>
<?php endif; ?> <?php endif; ?>
<?php if ( has_tag( 'ohwhatohjeez' ) ) : ?>
<li>This piece was originally written for my old site, Oh What? Oh Jeez! As such, it may not have transferred over properly and some images and links might be broken (and, to a lesser extent, my writing from years ago is about 80% run-on sentences).</li>
<?php endif; ?>
<?php if ( $notes = get_post_meta( get_the_ID(), 'Note(s)', true ) ) : ?>
<li><?php echo $notes; ?></li>
<?php endif; ?>
<?php if ( $license = get_post_meta( get_the_ID(), 'License', true ) ) : ?>
<li>This work is licensed under <?php echo $license; ?>. <a href="/2018/03/copywrong/">Sorry about that</a>.</li>
<?php endif; ?>
</ul>
</div>
<?php endif; ?>
<?php <?php if ( has_tag( 'ohwhatohjeez' ) ) : ?>
<li>This piece was originally written for my old site, Oh What? Oh Jeez! As such, it may not have transferred over properly and some images and links might be broken (and, to a lesser extent, my writing from years ago is about 80% run-on sentences).</li>
<?php endif; ?>
<?php
$notes = get_post_meta( get_the_ID(), 'Note(s)', true );
if ( $notes ) :
?>
<li><?php echo wp_kses_post( $notes ); ?></li>
<?php endif; ?>
<?php
$license = get_post_meta( get_the_ID(), 'License', true );
if ( $license ) :
?>
<li>This work is licensed under <?php echo esc_html( $license ); ?>. <a href="/2018/03/copywrong/">Sorry about that</a>.</li>
<?php endif; ?>
</ul>
</div>
<?php endif; ?>
<?php
if ( get_the_content() ) : if ( get_the_content() ) :
the_content(); the_content();
else : else :
echo get_the_excerpt(); echo esc_html( get_the_excerpt() );
endif; endif;
?> ?>
</main><!-- .entry-content -->
</main><!-- .entry-content -->
<footer id="post-meta">
<h1>Post Meta</h1>
<?php
$date_format_holocene = 'F j\<\s\u\p\>S\</\s\u\p\>, 1Y \<\a\b\b\r \t\i\t\l\e\=\"\H\o\l\o\c\e\n\e \E\r\a\"\>\H\.\E\.\</\a\b\b\r\>';
$date_format_gregorian = 'F jS, Y \C\.\E\. \(\G\r\e\g\o\r\i\a\n\)';
$date_holocene = get_the_date( $date_format_holocene );
$date_gregorian = get_the_date( $date_format_gregorian );
?>
<section id="post-dates">
<p><strong>Published:</strong>&nbsp;
<span title="<?php echo esc_html( $date_gregorian ); ?>">
<?php echo wp_kses_post( $date_holocene ); ?>
</span>
</p>
<?php
$modified_date_holocene = get_the_modified_date( $date_format_holocene );
$modified_date_gregorian = get_the_modified_date( $date_format_gregorian );
if ( $modified_date_holocene ) :
?>
<p><strong>Last Modified:</strong>&nbsp;
<span title="<?php echo esc_html( $modified_date_gregorian ); ?>">
<?php echo wp_kses_post( $modified_date_holocene ); ?>
</span>
</p>
<?php endif; ?>
</section>
<?php
$content = get_post_meta( get_the_ID(), 'External_Link', false );
if ( $content ) :
?>
<section id="post-links">
<h2>External Link<?php echo ( count( $content ) > 1 ) ? 's' : ''; ?></h2>
<?php foreach ( $content as $ext_link ) : ?>
<?php
$split_link = explode( ';;', $ext_link );
$link_title = ( count( $split_link ) > 1 ) ? wp_kses_post( $split_link[0] ) : 'Link';
$link_href = ( count( $split_link ) > 1 ) ? $split_link[1] : $split_link[0];
?>
<a href="<?php echo esc_url( $link_href ); ?>" target="_blank" rel="noopener noreferrer">
<?php echo wp_kses_post( $link_title ); ?>
</a>
<?php endforeach; ?>
</section>
<?php endif; ?>
<?php
$has_table_of_contents = ! ! get_post_meta( get_the_ID(), 'ToC1', true );
if ( $has_table_of_contents ) :
?>
<section id="post-contents">
<h2>Contents</h2>
<ol>
<?php
// phpcs:disable WordPress.CodeAnalysis.AssignmentInCondition
$i = 1;
while ( $section_title = get_post_meta( get_the_ID(), 'ToC' . $i, true ) ) :
?>
<li>
<a href="#section-<?php echo esc_attr( $i++ ); ?>">
<?php echo wp_kses_post( $content ); ?>
</a>
</li>
<?php
endwhile;
// phpcs:enable
?>
</ol>
</section>
<?php endif; ?>
<?php
$tags = get_the_tags( get_the_ID() );
if ( $tags ) :
?>
<section id="post-tags">
<h2>Tags</h2>
<?php foreach ( $tags as $post_tag ) : ?>
<a href="<?php echo esc_url( get_tag_link( $post_tag->term_id ) ); ?>" title="<?php echo esc_attr( $post_tag->name ); ?> Tag" class="tag-link">
<?php echo wp_kses_post( $post_tag->name ); ?>
</a>
<?php endforeach; ?>
</section>
<?php endif; ?>
</footer>
<footer id="post-meta">
<h1>Post Meta</h1>
<?php if ( $content = get_post_meta( get_the_ID(), 'ToC1', true ) ) : ?>
<section id="post-contents">
<h2>Contents</h2>
<ol>
<?php $i = 1; ?>
<?php while ( $content = get_post_meta( get_the_ID(), 'ToC' . $i, true ) ) : ?>
<li><a href="#section-<?php echo $i++; ?>"><?php echo $content; ?></a></li>
<?php endwhile; ?>
</ol>
</section>
<?php endif; ?>
<?php if ( $tags = get_the_tags( get_the_ID() ) ) : ?>
<section id="post-tags">
<h2>Tags</h2>
<?php foreach ( $tags as $tag ) : ?>
<a href="<?php echo get_tag_link( $tag->term_id ); ?>" title="<?php echo $tag->name; ?> Tag" class="tag-link">
<?php echo $tag->name; ?>
</a>
<?php endforeach; ?>
</section>
<?php endif; ?>
</footer>
</article><!-- #post-## --> </article><!-- #post-## -->

View file

@ -1,16 +1,24 @@
<?php <?php
/** /**
* The template part for displaying content. * The template part for displaying content.
* *
* @package WordPress * @package Omphaloskepsis
* @subpackage Omphaloskepsis * @since Omphaloskepsis 1.0
* @since Omphaloskepsis 1.0 */
*/
?> ?>
<a class="item" href="<?php echo ( $link = get_post_meta( get_the_ID(), 'External_Link', true ) ) ? $link : get_the_permalink(); ?>" <?php echo ( $link ) ? 'target="_blank"' : ''; ?>> <?php
<article id="post-<?php the_ID(); ?>" class="tile col-m-6 col-4 col-w-3" style="background-image: url('<?php the_post_thumbnail_url(); ?>');"> // For Posts with a) a single external link and b) no body content, just make
<?php // the item link directly to the external resource.
$has_one_external_link = count( get_post_meta( get_the_ID(), 'External_Link', false ) ) === 1;
$has_body_content = ! ! get_the_content();
$links_externally = $has_one_external_link && ! $has_body_content;
$post_link = ( $links_externally ) ? get_post_meta( get_the_ID(), 'External_Link', true ) : get_the_permalink();
?>
<a class="item" href="<?php echo esc_url( $post_link ); ?>"<?php echo ( $links_externally ) ? ' target="_blank" rel="noopener noreferrer"' : ''; ?>>
<article id="post-<?php the_ID(); ?>" class="tile col-m-6 col-4 col-w-3" style="background-image: url('<?php the_post_thumbnail_url(); ?>');">
<?php
if ( strlen( get_the_title() ) > 70 ) { if ( strlen( get_the_title() ) > 70 ) {
$small = 'vsmall'; $small = 'vsmall';
} elseif ( strlen( get_the_title() ) > 35 ) { } elseif ( strlen( get_the_title() ) > 35 ) {
@ -19,11 +27,18 @@
$small = 'qsmall'; $small = 'qsmall';
} }
?> ?>
<header> <header>
<h1 class="<?php echo $small; ?> post-title"><?php echo get_the_title(); ?></h1> <h1 class="<?php echo esc_attr( $small ); ?> post-title">
<?php if ( $subtitle = get_post_meta( get_the_ID(), 'Subtitle', true ) ) : ?> <?php echo wp_kses_post( get_the_title() ); ?>
<h2><?php echo $subtitle; ?></h2> </h1>
<?php endif; ?> <?php
</header> $subtitle = get_post_meta( get_the_ID(), 'Subtitle', true );
</article><!-- #post-## --> if ( $subtitle ) :
?>
<h2>
<?php echo wp_kses_post( $subtitle ); ?>
</h2>
<?php endif; ?>
</header>
</article><!-- #post-## -->
</a> </a>