From 3c30f664b887f81edc73e5b1e75534649ab48e88 Mon Sep 17 00:00:00 2001
From: Ben Goldsworthy
Date: Sat, 9 Jan 2021 10:35:19 +0000
Subject: [PATCH 1/2] Add Post Tag display
---
style.css | 26 ++++++++++++++++++++------
template-parts/content-single.php | 31 ++++++++++++++++++++++---------
2 files changed, 42 insertions(+), 15 deletions(-)
diff --git a/style.css b/style.css
index fbffcf2..257ef60 100644
--- a/style.css
+++ b/style.css
@@ -320,7 +320,7 @@ html {
align-items: center;
grid-template-areas:
"post-content-header post-content"
- " post-toc post-content"
+ " post-meta post-content"
" . post-content";
}
}
@@ -378,25 +378,39 @@ html {
grid-area: post-date;
}
- #split-page #post-toc {
- grid-area: post-toc;
+ #split-page #post-meta {
+ grid-area: post-meta;
width: 100%;
text-align: left;
}
- #split-page #post-toc > h1 {
+ #split-page #post-meta > h1 {
border-bottom: 2px inset var(--dark);
margin-top: 0.5em;
margin-bottom: 0.5em;
line-height: 1.2em;
- text-align: center;
+ text-align: left;
}
- #split-page #post-toc > ol > li {
+ #split-page #post-meta h2 {
+ margin-top: 0.5em;
+ font-size: 1.4em;
+ margin-bottom: 0.5em;
+ line-height: 1.2em;
+ text-align: left;
+ }
+
+ #split-page #post-meta > #post-contents > ol > li {
margin-top: 0.5em;
margin-bottom: 0.5em;
}
+
+ #split-page #post-meta > #post-tags > a {
+ margin-top: 0.2em;
+ margin-left: 1em;
+ }
+
#split-page > #wrapper > .body {
grid-area: post-content;
display: block;
diff --git a/template-parts/content-single.php b/template-parts/content-single.php
index 9dfde51..2a9578d 100644
--- a/template-parts/content-single.php
+++ b/template-parts/content-single.php
@@ -64,7 +64,7 @@
- This work is licensed under . Sorry about that .
+ This work is licensed under . Sorry about that .
@@ -79,15 +79,28 @@
?>
-
+
+ Post Meta
- Contents
-
-
-
-
-
-
+
+
+
+
From c5a41ae9eac0424883ce96f9a3f65b2682f38c1a Mon Sep 17 00:00:00 2001
From: Ben Goldsworthy
Date: Sat, 9 Jan 2021 11:13:06 +0000
Subject: [PATCH 2/2] Add PHPCS config, lint files
---
404.php | 12 +-
archive.php | 83 ++--
centred-page.php | 27 +-
comments.php | 80 ++--
footer.php | 40 +-
functions.php | 643 ++++++++++++++++--------------
header.php | 40 +-
home.php | 87 ++--
inc/back-compat.php | 10 +-
inc/customizer.php | 454 ++++++++++++---------
inc/template-tags.php | 303 +++++++-------
page-experience-by-companies.php | 199 ++++-----
page-experience-by-locations.php | 136 ++++---
page.php | 38 +-
phpcs.xml | 34 ++
search.php | 19 +-
sidebar.php | 32 +-
single.php | 37 +-
taxonomy-company.php | 443 ++++++++++----------
template-parts/content-none.php | 12 +-
template-parts/content-page.php | 34 +-
template-parts/content-single.php | 180 +++++----
template-parts/content.php | 42 +-
zzpage-experience.php | 128 +++---
24 files changed, 1686 insertions(+), 1427 deletions(-)
create mode 100644 phpcs.xml
diff --git a/404.php b/404.php
index aa1fe9f..deeee6e 100644
--- a/404.php
+++ b/404.php
@@ -1,11 +1,11 @@
diff --git a/archive.php b/archive.php
index f9833a9..9b87f07 100644
--- a/archive.php
+++ b/archive.php
@@ -1,57 +1,62 @@
- .
- ' ',
- 'mid_size' => 20,
- 'prev_text' => '',
- 'next_text' => '',
- ));
- ?>
+ .
+ ' ',
+ 'mid_size' => 20,
+ 'prev_text' => '',
+ 'next_text' => '',
+ )
+ );
+ ?>
-
+ // If no content, include the "No posts found" template.
+ else :
+ get_template_part( 'template-parts/content', 'none' );
+ endif;
+ ?>
- ' ',
- 'mid_size' => 20,
- 'prev_text' => '',
- 'next_text' => '',
- ));
- ?>
+ ' ',
+ 'mid_size' => 20,
+ 'prev_text' => '',
+ 'next_text' => '',
+ )
+ );
+ ?>
diff --git a/centred-page.php b/centred-page.php
index df30a56..7249b9d 100644
--- a/centred-page.php
+++ b/centred-page.php
@@ -1,23 +1,26 @@
-
+
diff --git a/comments.php b/comments.php
index b981b27..8d72050 100644
--- a/comments.php
+++ b/comments.php
@@ -1,53 +1,59 @@
diff --git a/footer.php b/footer.php
index 7ab589e..5b3f2af 100644
--- a/footer.php
+++ b/footer.php
@@ -1,13 +1,13 @@
-
+
-
+ link.innerHTML = (link.innerHTML == linkText[0]) ? linkText[1] : linkText[0];
+ }
+
+
id="site-wrapper">
-
+
-
+
diff --git a/home.php b/home.php
index 3683f01..2489dbc 100644
--- a/home.php
+++ b/home.php
@@ -1,61 +1,66 @@
- Blog.
-
- ' ',
- 'mid_size' => 20,
- 'prev_text' => '',
- 'next_text' => '',
- ));
- ?>
+ Blog.
+
+ ' ',
+ 'mid_size' => 20,
+ 'prev_text' => '',
+ 'next_text' => '',
+ )
+ );
+ ?>
-
+ // If no content, include the "No posts found" template.
+ else :
+ get_template_part( 'template-parts/content', 'none' );
+ endif;
+ ?>
- ' ',
- 'mid_size' => 20,
- 'prev_text' => '',
- 'next_text' => '',
- ));
- ?>
+ ' ',
+ 'mid_size' => 20,
+ 'prev_text' => '',
+ 'next_text' => '',
+ )
+ );
+ ?>
-
+
diff --git a/inc/back-compat.php b/inc/back-compat.php
index 7ed4240..c97940e 100644
--- a/inc/back-compat.php
+++ b/inc/back-compat.php
@@ -50,9 +50,13 @@ function twentysixteen_upgrade_notice() {
* @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,
- ) );
+ 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' );
diff --git a/inc/customizer.php b/inc/customizer.php
index 794752d..e46ac05 100644
--- a/inc/customizer.php
+++ b/inc/customizer.php
@@ -30,9 +30,15 @@ function twentysixteen_custom_header_and_background() {
* @type string $default-color Default color of the background.
* }
*/
- add_theme_support( 'custom-background', apply_filters( 'twentysixteen_custom_background_args', array(
- 'default-color' => $default_background_color,
- ) ) );
+ add_theme_support(
+ 'custom-background',
+ apply_filters(
+ 'twentysixteen_custom_background_args',
+ array(
+ 'default-color' => $default_background_color,
+ )
+ )
+ );
/**
* Filter the arguments used when adding 'custom-header' support in Twenty Sixteen.
@@ -50,34 +56,40 @@ function twentysixteen_custom_header_and_background() {
* displayed on the blog.
* }
*/
- add_theme_support( 'custom-header', apply_filters( 'twentysixteen_custom_header_args', array(
- 'default-text-color' => $default_text_color,
- 'width' => 1200,
- 'height' => 280,
- 'flex-height' => true,
- 'wp-head-callback' => 'twentysixteen_header_style',
- ) ) );
+ add_theme_support(
+ 'custom-header',
+ apply_filters(
+ 'twentysixteen_custom_header_args',
+ array(
+ 'default-text-color' => $default_text_color,
+ 'width' => 1200,
+ 'height' => 280,
+ 'flex-height' => true,
+ 'wp-head-callback' => 'twentysixteen_header_style',
+ )
+ )
+ );
}
add_action( 'after_setup_theme', 'twentysixteen_custom_header_and_background' );
if ( ! function_exists( 'twentysixteen_header_style' ) ) :
-/**
- * Styles the header text displayed on the site.
- *
- * Create your own twentysixteen_header_style() function to override in a child theme.
- *
- * @since Twenty Sixteen 1.0
- *
- * @see twentysixteen_custom_header_and_background().
- */
-function twentysixteen_header_style() {
- // If the header text option is untouched, let's bail.
- if ( display_header_text() ) {
- return;
- }
+ /**
+ * Styles the header text displayed on the site.
+ *
+ * Create your own twentysixteen_header_style() function to override in a child theme.
+ *
+ * @since Twenty Sixteen 1.0
+ *
+ * @see twentysixteen_custom_header_and_background().
+ */
+ function twentysixteen_header_style() {
+ // If the header text option is untouched, let's bail.
+ if ( display_header_text() ) {
+ return;
+ }
- // If the header text has been hidden.
- ?>
+ // If the header text has been hidden.
+ ?>
- get_setting( 'blogdescription' )->transport = 'postMessage';
if ( isset( $wp_customize->selective_refresh ) ) {
- $wp_customize->selective_refresh->add_partial( 'blogname', array(
- 'selector' => '.site-title a',
- 'container_inclusive' => false,
- 'render_callback' => 'twentysixteen_customize_partial_blogname',
- ) );
- $wp_customize->selective_refresh->add_partial( 'blogdescription', array(
- 'selector' => '.site-description',
- 'container_inclusive' => false,
- 'render_callback' => 'twentysixteen_customize_partial_blogdescription',
- ) );
+ $wp_customize->selective_refresh->add_partial(
+ 'blogname',
+ array(
+ 'selector' => '.site-title a',
+ 'container_inclusive' => false,
+ 'render_callback' => 'twentysixteen_customize_partial_blogname',
+ )
+ );
+ $wp_customize->selective_refresh->add_partial(
+ 'blogdescription',
+ array(
+ 'selector' => '.site-description',
+ 'container_inclusive' => false,
+ 'render_callback' => 'twentysixteen_customize_partial_blogdescription',
+ )
+ );
}
// Add color scheme setting and control.
- $wp_customize->add_setting( 'color_scheme', array(
- 'default' => 'default',
- 'sanitize_callback' => 'twentysixteen_sanitize_color_scheme',
- 'transport' => 'postMessage',
- ) );
+ $wp_customize->add_setting(
+ 'color_scheme',
+ array(
+ 'default' => 'default',
+ 'sanitize_callback' => 'twentysixteen_sanitize_color_scheme',
+ 'transport' => 'postMessage',
+ )
+ );
- $wp_customize->add_control( 'color_scheme', array(
- 'label' => __( 'Base Color Scheme', 'twentysixteen' ),
- 'section' => 'colors',
- 'type' => 'select',
- 'choices' => twentysixteen_get_color_scheme_choices(),
- 'priority' => 1,
- ) );
+ $wp_customize->add_control(
+ 'color_scheme',
+ array(
+ 'label' => __( 'Base Color Scheme', 'twentysixteen' ),
+ 'section' => 'colors',
+ 'type' => 'select',
+ 'choices' => twentysixteen_get_color_scheme_choices(),
+ 'priority' => 1,
+ )
+ );
// Add page background color setting and control.
- $wp_customize->add_setting( 'page_background_color', array(
- 'default' => $color_scheme[1],
- 'sanitize_callback' => 'sanitize_hex_color',
- 'transport' => 'postMessage',
- ) );
+ $wp_customize->add_setting(
+ 'page_background_color',
+ array(
+ 'default' => $color_scheme[1],
+ 'sanitize_callback' => 'sanitize_hex_color',
+ 'transport' => 'postMessage',
+ )
+ );
- $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'page_background_color', array(
- 'label' => __( 'Page Background Color', 'twentysixteen' ),
- 'section' => 'colors',
- ) ) );
+ $wp_customize->add_control(
+ new WP_Customize_Color_Control(
+ $wp_customize,
+ 'page_background_color',
+ array(
+ 'label' => __( 'Page Background Color', 'twentysixteen' ),
+ 'section' => 'colors',
+ )
+ )
+ );
// Remove the core header textcolor control, as it shares the main text color.
$wp_customize->remove_control( 'header_textcolor' );
// Add link color setting and control.
- $wp_customize->add_setting( 'link_color', array(
- 'default' => $color_scheme[2],
- 'sanitize_callback' => 'sanitize_hex_color',
- 'transport' => 'postMessage',
- ) );
+ $wp_customize->add_setting(
+ 'link_color',
+ array(
+ 'default' => $color_scheme[2],
+ 'sanitize_callback' => 'sanitize_hex_color',
+ 'transport' => 'postMessage',
+ )
+ );
- $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_color', array(
- 'label' => __( 'Link Color', 'twentysixteen' ),
- 'section' => 'colors',
- ) ) );
+ $wp_customize->add_control(
+ new WP_Customize_Color_Control(
+ $wp_customize,
+ 'link_color',
+ array(
+ 'label' => __( 'Link Color', 'twentysixteen' ),
+ 'section' => 'colors',
+ )
+ )
+ );
// Add main text color setting and control.
- $wp_customize->add_setting( 'main_text_color', array(
- 'default' => $color_scheme[3],
- 'sanitize_callback' => 'sanitize_hex_color',
- 'transport' => 'postMessage',
- ) );
+ $wp_customize->add_setting(
+ 'main_text_color',
+ array(
+ 'default' => $color_scheme[3],
+ 'sanitize_callback' => 'sanitize_hex_color',
+ 'transport' => 'postMessage',
+ )
+ );
- $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'main_text_color', array(
- 'label' => __( 'Main Text Color', 'twentysixteen' ),
- 'section' => 'colors',
- ) ) );
+ $wp_customize->add_control(
+ new WP_Customize_Color_Control(
+ $wp_customize,
+ 'main_text_color',
+ array(
+ 'label' => __( 'Main Text Color', 'twentysixteen' ),
+ 'section' => 'colors',
+ )
+ )
+ );
// Add secondary text color setting and control.
- $wp_customize->add_setting( 'secondary_text_color', array(
- 'default' => $color_scheme[4],
- 'sanitize_callback' => 'sanitize_hex_color',
- 'transport' => 'postMessage',
- ) );
+ $wp_customize->add_setting(
+ 'secondary_text_color',
+ array(
+ 'default' => $color_scheme[4],
+ 'sanitize_callback' => 'sanitize_hex_color',
+ 'transport' => 'postMessage',
+ )
+ );
- $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'secondary_text_color', array(
- 'label' => __( 'Secondary Text Color', 'twentysixteen' ),
- 'section' => 'colors',
- ) ) );
+ $wp_customize->add_control(
+ new WP_Customize_Color_Control(
+ $wp_customize,
+ 'secondary_text_color',
+ array(
+ 'label' => __( 'Secondary Text Color', 'twentysixteen' ),
+ 'section' => 'colors',
+ )
+ )
+ );
}
add_action( 'customize_register', 'twentysixteen_customize_register', 11 );
@@ -248,127 +308,130 @@ function twentysixteen_get_color_schemes() {
* }
* }
*/
- return apply_filters( 'twentysixteen_color_schemes', array(
- 'default' => array(
- 'label' => __( 'Default', 'twentysixteen' ),
- 'colors' => array(
- '#1a1a1a',
- '#ffffff',
- '#007acc',
- '#1a1a1a',
- '#686868',
+ return apply_filters(
+ 'twentysixteen_color_schemes',
+ array(
+ 'default' => array(
+ 'label' => __( 'Default', 'twentysixteen' ),
+ 'colors' => array(
+ '#1a1a1a',
+ '#ffffff',
+ '#007acc',
+ '#1a1a1a',
+ '#686868',
+ ),
),
- ),
- 'dark' => array(
- 'label' => __( 'Dark', 'twentysixteen' ),
- 'colors' => array(
- '#262626',
- '#1a1a1a',
- '#9adffd',
- '#e5e5e5',
- '#c1c1c1',
+ 'dark' => array(
+ 'label' => __( 'Dark', 'twentysixteen' ),
+ 'colors' => array(
+ '#262626',
+ '#1a1a1a',
+ '#9adffd',
+ '#e5e5e5',
+ '#c1c1c1',
+ ),
),
- ),
- 'gray' => array(
- 'label' => __( 'Gray', 'twentysixteen' ),
- 'colors' => array(
- '#616a73',
- '#4d545c',
- '#c7c7c7',
- '#f2f2f2',
- '#f2f2f2',
+ 'gray' => array(
+ 'label' => __( 'Gray', 'twentysixteen' ),
+ 'colors' => array(
+ '#616a73',
+ '#4d545c',
+ '#c7c7c7',
+ '#f2f2f2',
+ '#f2f2f2',
+ ),
),
- ),
- 'red' => array(
- 'label' => __( 'Red', 'twentysixteen' ),
- 'colors' => array(
- '#ffffff',
- '#ff675f',
- '#640c1f',
- '#402b30',
- '#402b30',
+ 'red' => array(
+ 'label' => __( 'Red', 'twentysixteen' ),
+ 'colors' => array(
+ '#ffffff',
+ '#ff675f',
+ '#640c1f',
+ '#402b30',
+ '#402b30',
+ ),
),
- ),
- 'yellow' => array(
- 'label' => __( 'Yellow', 'twentysixteen' ),
- 'colors' => array(
- '#3b3721',
- '#ffef8e',
- '#774e24',
- '#3b3721',
- '#5b4d3e',
+ 'yellow' => array(
+ 'label' => __( 'Yellow', 'twentysixteen' ),
+ 'colors' => array(
+ '#3b3721',
+ '#ffef8e',
+ '#774e24',
+ '#3b3721',
+ '#5b4d3e',
+ ),
),
- ),
- ) );
+ )
+ );
}
if ( ! function_exists( 'twentysixteen_get_color_scheme' ) ) :
-/**
- * Retrieves the current Twenty Sixteen color scheme.
- *
- * Create your own twentysixteen_get_color_scheme() function to override in a child theme.
- *
- * @since Twenty Sixteen 1.0
- *
- * @return array An associative array of either the current or default color scheme HEX values.
- */
-function twentysixteen_get_color_scheme() {
- $color_scheme_option = get_theme_mod( 'color_scheme', 'default' );
- $color_schemes = twentysixteen_get_color_schemes();
+ /**
+ * Retrieves the current Twenty Sixteen color scheme.
+ *
+ * Create your own twentysixteen_get_color_scheme() function to override in a child theme.
+ *
+ * @since Twenty Sixteen 1.0
+ *
+ * @return array An associative array of either the current or default color scheme HEX values.
+ */
+ function twentysixteen_get_color_scheme() {
+ $color_scheme_option = get_theme_mod( 'color_scheme', 'default' );
+ $color_schemes = twentysixteen_get_color_schemes();
- if ( array_key_exists( $color_scheme_option, $color_schemes ) ) {
- return $color_schemes[ $color_scheme_option ]['colors'];
+ if ( array_key_exists( $color_scheme_option, $color_schemes ) ) {
+ return $color_schemes[ $color_scheme_option ]['colors'];
+ }
+
+ return $color_schemes['default']['colors'];
}
-
- return $color_schemes['default']['colors'];
-}
endif; // twentysixteen_get_color_scheme
if ( ! function_exists( 'twentysixteen_get_color_scheme_choices' ) ) :
-/**
- * Retrieves an array of color scheme choices registered for Twenty Sixteen.
- *
- * Create your own twentysixteen_get_color_scheme_choices() function to override
- * in a child theme.
- *
- * @since Twenty Sixteen 1.0
- *
- * @return array Array of color schemes.
- */
-function twentysixteen_get_color_scheme_choices() {
- $color_schemes = twentysixteen_get_color_schemes();
- $color_scheme_control_options = array();
+ /**
+ * Retrieves an array of color scheme choices registered for Twenty Sixteen.
+ *
+ * Create your own twentysixteen_get_color_scheme_choices() function to override
+ * in a child theme.
+ *
+ * @since Twenty Sixteen 1.0
+ *
+ * @return array Array of color schemes.
+ */
+ function twentysixteen_get_color_scheme_choices() {
+ $color_schemes = twentysixteen_get_color_schemes();
+ $color_scheme_control_options = array();
- foreach ( $color_schemes as $color_scheme => $value ) {
- $color_scheme_control_options[ $color_scheme ] = $value['label'];
+ foreach ( $color_schemes as $color_scheme => $value ) {
+ $color_scheme_control_options[ $color_scheme ] = $value['label'];
+ }
+
+ return $color_scheme_control_options;
}
-
- return $color_scheme_control_options;
-}
endif; // twentysixteen_get_color_scheme_choices
if ( ! function_exists( 'twentysixteen_sanitize_color_scheme' ) ) :
-/**
- * Handles sanitization for Twenty Sixteen color schemes.
- *
- * Create your own twentysixteen_sanitize_color_scheme() function to override
- * in a child theme.
- *
- * @since Twenty Sixteen 1.0
- *
- * @param string $value Color scheme name value.
- * @return string Color scheme name.
- */
-function twentysixteen_sanitize_color_scheme( $value ) {
- $color_schemes = twentysixteen_get_color_scheme_choices();
+ /**
+ * Handles sanitization for Twenty Sixteen color schemes.
+ *
+ * Create your own twentysixteen_sanitize_color_scheme() function to override
+ * in a child theme.
+ *
+ * @since Twenty Sixteen 1.0
+ *
+ * @param string $value Color scheme name value.
+ * @return string Color scheme name.
+ */
+ function twentysixteen_sanitize_color_scheme( $value ) {
+ $color_schemes = twentysixteen_get_color_scheme_choices();
- if ( ! array_key_exists( $value, $color_schemes ) ) {
- return 'default';
+ if ( ! array_key_exists( $value, $color_schemes ) ) {
+ return 'default';
+ }
+
+ return $value;
}
-
- return $value;
-}
endif; // twentysixteen_sanitize_color_scheme
/**
@@ -445,14 +508,17 @@ add_action( 'customize_preview_init', 'twentysixteen_customize_preview_js' );
* @return string Color scheme CSS.
*/
function twentysixteen_get_color_scheme_css( $colors ) {
- $colors = wp_parse_args( $colors, array(
- 'background_color' => '',
- 'page_background_color' => '',
- 'link_color' => '',
- 'main_text_color' => '',
- 'secondary_text_color' => '',
- 'border_color' => '',
- ) );
+ $colors = wp_parse_args(
+ $colors,
+ array(
+ 'background_color' => '',
+ 'page_background_color' => '',
+ 'link_color' => '',
+ 'main_text_color' => '',
+ 'secondary_text_color' => '',
+ 'border_color' => '',
+ )
+ );
return <<%1$s%4$s ',
- 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()
- );
- }
+ /**
+ * 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(
+ '%1$s%4$s ',
+ 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();
- }
+ if ( in_array( get_post_type(), array( 'post', 'attachment' ) ) ) {
+ twentysixteen_entry_date();
+ }
- $format = get_post_format();
- if ( current_theme_supports( 'post-formats', $format ) ) {
- printf( '%1$s%3$s ',
- sprintf( '%s ', _x( 'Format', 'Used before post format.', 'twentysixteen' ) ),
- esc_url( get_post_format_link( $format ) ),
- get_post_format_string( $format )
- );
- }
-
- edit_post_link(
- sprintf(
+ $format = get_post_format();
+ if ( current_theme_supports( 'post-formats', $format ) ) {
+ printf(
+ '%1$s%3$s ',
+ sprintf( '%s ', _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()
- ),
- '',
- ' '
- );
-
-
-}
+ __( 'Edit', 'twentysixteen' ),
+ get_the_title()
+ ),
+ '',
+ ' '
+ );
+
+ }
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 = '%2$s ';
+ /**
+ * 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 = '%2$s ';
- if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
- $time_string = '%2$s ';
+ if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
+ $time_string = '%2$s ';
+ }
+
+ $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(
+ '%3$s ',
+ _x( 'Posted on', 'Used before publish date.', 'bengoldsworthy' ),
+ esc_url( get_permalink() ),
+ $time_string
+ );
}
-
- $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( '%3$s ',
- _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( '%1$s %2$s ',
- _x( 'Categories', 'Used before category names.', 'twentysixteen' ),
- $categories_list
- );
- }
+ /**
+ * 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(
+ '%1$s %2$s ',
+ _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( '%1$s %2$s ',
- _x( 'Tags', 'Used before tag names.', 'twentysixteen' ),
- $tags_list
- );
+ $tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'twentysixteen' ) );
+ if ( $tags_list ) {
+ printf(
+ '%1$s %2$s ',
+ _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;
- }
+ /**
+ * 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() ) :
- ?>
+ if ( is_singular() ) :
+ ?>
diff --git a/functions.php b/functions.php
index 2e1d63e..c0dd789 100644
--- a/functions.php
+++ b/functions.php
@@ -55,7 +55,7 @@ if ( ! function_exists( 'omphaloskepsis_setup' ) ) :
* to change 'omphaloskepsis' to the name of your theme in all the template files
*/
load_theme_textdomain( 'omphaloskepsis', get_template_directory() . '/languages' );
-
+
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
@@ -72,11 +72,14 @@ if ( ! function_exists( 'omphaloskepsis_setup' ) ) :
*
* @since Omphaloskepsis 1.2
*/
- add_theme_support( 'custom-logo', array(
- 'height' => 2256,
- 'width' => 1622,
- 'flex-height' => true,
- ) );
+ add_theme_support(
+ 'custom-logo',
+ array(
+ 'height' => 2256,
+ 'width' => 1622,
+ 'flex-height' => true,
+ )
+ );
/*
* Enable support for Post Thumbnails on posts and pages.
@@ -87,62 +90,73 @@ if ( ! function_exists( 'omphaloskepsis_setup' ) ) :
set_post_thumbnail_size( 1200, 9999 );
// This theme uses wp_nav_menu() in two locations.
- register_nav_menus( array(
- 'primary' => __( 'Primary Menu', 'omphaloskepsis' ),
- 'social' => __( 'Social Links Menu', 'omphaloskepsis' ),
- ) );
-
- function omphaloskepsis_infinite_scroll_init() {
- add_theme_support( 'infinite-scroll', array(
- 'container' => 'main',
- 'render' => 'omphaloskepsis_infinite_scroll_render',
- 'footer' => 'colophon',
- ) );
-}
+ register_nav_menus(
+ array(
+ 'primary' => __( 'Primary Menu', 'omphaloskepsis' ),
+ 'social' => __( 'Social Links Menu', 'omphaloskepsis' ),
+ )
+ );
-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() );
+ 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
* to output valid HTML5.
*/
- add_theme_support( 'html5', array(
- 'search-form',
- 'comment-form',
- 'comment-list',
- 'gallery',
- 'caption',
- ) );
+ add_theme_support(
+ 'html5',
+ array(
+ 'search-form',
+ 'comment-form',
+ 'comment-list',
+ 'gallery',
+ 'caption',
+ )
+ );
/*
* Enable support for Post Formats.
*
* See: https://codex.wordpress.org/Post_Formats
*/
- add_theme_support( 'post-formats', array(
- 'aside',
- 'image',
- 'video',
- 'quote',
- 'link',
- 'gallery',
- 'status',
- 'audio',
- 'chat',
- ) );
+ add_theme_support(
+ 'post-formats',
+ array(
+ 'aside',
+ 'image',
+ 'video',
+ 'quote',
+ 'link',
+ 'gallery',
+ 'status',
+ 'audio',
+ 'chat',
+ )
+ );
/*
* This theme styles the visual editor to resemble the theme style,
@@ -178,35 +192,41 @@ add_action( 'after_setup_theme', 'omphaloskepsis_content_width', 0 );
* @since Omphaloskepsis 1.0
*/
function omphaloskepsis_widgets_init() {
- register_sidebar( array(
- 'name' => __( 'Sidebar', 'omphaloskepsis' ),
- 'id' => 'sidebar-1',
- 'description' => __( 'Add widgets here to appear in your sidebar.', 'omphaloskepsis' ),
- 'before_widget' => '',
- 'before_title' => '
',
- ) );
+ register_sidebar(
+ array(
+ 'name' => __( 'Sidebar', 'omphaloskepsis' ),
+ 'id' => 'sidebar-1',
+ 'description' => __( 'Add widgets here to appear in your sidebar.', 'omphaloskepsis' ),
+ 'before_widget' => '',
+ 'before_title' => '
',
+ )
+ );
- register_sidebar( array(
- 'name' => __( 'Content Bottom 1', 'omphaloskepsis' ),
- 'id' => 'sidebar-2',
- 'description' => __( 'Appears at the bottom of the content on posts and pages.', 'omphaloskepsis' ),
- 'before_widget' => '',
- 'before_title' => '
',
- ) );
+ register_sidebar(
+ array(
+ 'name' => __( 'Content Bottom 1', 'omphaloskepsis' ),
+ 'id' => 'sidebar-2',
+ 'description' => __( 'Appears at the bottom of the content on posts and pages.', 'omphaloskepsis' ),
+ 'before_widget' => '',
+ 'before_title' => '
',
+ )
+ );
- register_sidebar( array(
- 'name' => __( 'Content Bottom 2', 'omphaloskepsis' ),
- 'id' => 'sidebar-3',
- 'description' => __( 'Appears at the bottom of the content on posts and pages.', 'omphaloskepsis' ),
- 'before_widget' => '',
- 'before_title' => '
',
- ) );
+ register_sidebar(
+ array(
+ 'name' => __( 'Content Bottom 2', 'omphaloskepsis' ),
+ 'id' => 'sidebar-3',
+ 'description' => __( 'Appears at the bottom of the content on posts and pages.', 'omphaloskepsis' ),
+ 'before_widget' => '',
+ 'before_title' => '
',
+ )
+ );
}
add_action( 'widgets_init', 'omphaloskepsis_widgets_init' );
@@ -241,10 +261,13 @@ if ( ! function_exists( 'omphaloskepsis_fonts_url' ) ) :
}
if ( $fonts ) {
- $fonts_url = add_query_arg( array(
- 'family' => urlencode( implode( '|', $fonts ) ),
- 'subset' => urlencode( $subsets ),
- ), 'https://fonts.googleapis.com/css' );
+ $fonts_url = add_query_arg(
+ array(
+ 'family' => urlencode( implode( '|', $fonts ) ),
+ 'subset' => urlencode( $subsets ),
+ ),
+ 'https://fonts.googleapis.com/css'
+ );
}
return $fonts_url;
@@ -270,8 +293,8 @@ add_action( 'wp_head', 'omphaloskepsis_javascript_detection', 0 );
*/
function omphaloskepsis_scripts() {
// 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(), null );
+
wp_style_add_data( 'omphaloskepsis-ie', 'conditional', 'lt IE 10' );
// Add custom fonts, used in the main stylesheet.
wp_enqueue_style( 'omphaloskepsis-fonts', omphaloskepsis_fonts_url(), array(), null );
@@ -281,10 +304,10 @@ function omphaloskepsis_scripts() {
// Theme stylesheet.
wp_enqueue_style( 'omphaloskepsis-style', get_stylesheet_uri() );
-
- wp_enqueue_style('font-awesome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css');
-
- wp_enqueue_style( 'montserrat', "https://fonts.googleapis.com/css?family=Montserrat" );
+
+ wp_enqueue_style( 'font-awesome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css' );
+
+ wp_enqueue_style( 'montserrat', 'https://fonts.googleapis.com/css?family=Montserrat' );
// Load the Internet Explorer specific stylesheet.
wp_enqueue_style( 'omphaloskepsis-ie', get_template_directory_uri() . '/css/ie.css', array( 'omphaloskepsis-style' ), '20160412' );
@@ -314,10 +337,14 @@ function omphaloskepsis_scripts() {
wp_enqueue_script( 'omphaloskepsis-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20160412', true );
- wp_localize_script( 'omphaloskepsis-script', 'screenReaderText', array(
- 'expand' => __( 'expand child menu', 'omphaloskepsis' ),
- 'collapse' => __( 'collapse child menu', 'omphaloskepsis' ),
- ) );
+ wp_localize_script(
+ 'omphaloskepsis-script',
+ 'screenReaderText',
+ array(
+ 'expand' => __( 'expand child menu', 'omphaloskepsis' ),
+ 'collapse' => __( 'collapse child menu', 'omphaloskepsis' ),
+ )
+ );
}
add_action( 'wp_enqueue_scripts', 'omphaloskepsis_scripts' );
@@ -367,9 +394,9 @@ function omphaloskepsis_hex2rgb( $color ) {
$color = trim( $color, '#' );
if ( strlen( $color ) === 3 ) {
- $r = hexdec( substr( $color, 0, 1 ).substr( $color, 0, 1 ) );
- $g = hexdec( substr( $color, 1, 1 ).substr( $color, 1, 1 ) );
- $b = hexdec( substr( $color, 2, 1 ).substr( $color, 2, 1 ) );
+ $r = hexdec( substr( $color, 0, 1 ) . substr( $color, 0, 1 ) );
+ $g = hexdec( substr( $color, 1, 1 ) . substr( $color, 1, 1 ) );
+ $b = hexdec( substr( $color, 2, 1 ) . substr( $color, 2, 1 ) );
} else if ( strlen( $color ) === 6 ) {
$r = hexdec( substr( $color, 0, 2 ) );
$g = hexdec( substr( $color, 2, 2 ) );
@@ -378,7 +405,11 @@ function omphaloskepsis_hex2rgb( $color ) {
return array();
}
- return array( 'red' => $r, 'green' => $g, 'blue' => $b );
+ return array(
+ 'red' => $r,
+ 'green' => $g,
+ 'blue' => $b,
+ );
}
/**
@@ -416,7 +447,7 @@ function omphaloskepsis_content_image_sizes_attr( $sizes, $size ) {
return $sizes;
}
-add_filter( 'wp_calculate_image_sizes', 'omphaloskepsis_content_image_sizes_attr', 10 , 2 );
+add_filter( 'wp_calculate_image_sizes', 'omphaloskepsis_content_image_sizes_attr', 10, 2 );
/**
* Add custom image sizes attribute to enhance responsive image functionality
@@ -436,7 +467,7 @@ function omphaloskepsis_post_thumbnail_sizes_attr( $attr, $attachment, $size ) {
}
return $attr;
}
-add_filter( 'wp_get_attachment_image_attributes', 'omphaloskepsis_post_thumbnail_sizes_attr', 10 , 3 );
+add_filter( 'wp_get_attachment_image_attributes', 'omphaloskepsis_post_thumbnail_sizes_attr', 10, 3 );
/**
* Modifies tag cloud widget arguments to have all tags in the widget same font size.
@@ -447,219 +478,243 @@ add_filter( 'wp_get_attachment_image_attributes', 'omphaloskepsis_post_thumbnail
* @return array A new modified arguments.
*/
function omphaloskepsis_widget_tag_cloud_args( $args ) {
- $args['largest'] = 1;
- $args['smallest'] = 1;
- $args['unit'] = 'em';
- return $args;
+ $args['largest'] = 1;
+ $args['smallest'] = 1;
+ $args['unit'] = 'em';
+ return $args;
}
add_filter( 'widget_tag_cloud_args', 'omphaloskepsis_widget_tag_cloud_args' );
-function clean_script_tag($input) {
- $input = str_replace("type='text/javascript' ", '', $input);
- return str_replace("'", '"', $input);
+function clean_script_tag( $input ) {
+ $input = str_replace( "type='text/javascript' ", '', $input );
+ return str_replace( "'", '"', $input );
}
-add_filter('script_loader_tag', 'clean_script_tag');
+add_filter( 'script_loader_tag', 'clean_script_tag' );
-function omphaloskepsis_the_content($content) {
- global $post;
- if ($post->post_type == "program") {
- if ($meta = get_post_meta($post->ID, 'Link', true))
- $links = $links . 'Download ';
- if ($meta = get_post_meta($post->ID, 'Documentation', true))
- $links = $links . 'Documentation ';
- if ($meta = get_post_meta($post->ID, 'Repo', true))
- $links = $links . 'Repo ';
- if ($meta = get_post_meta($post->ID, 'Licence', true))
- $links = $links . 'Licence ';
- if ($meta = get_post_meta($post->ID, 'MD5', true))
- $links = $links . '
MD5 checksum: '.$meta.'
';
- return $content . $links;
- } elseif ($post->post_type == "website") {
- if ($meta = get_post_meta($post->ID, 'Link', true))
- $links = $links . 'Visit ';
- if ($meta = get_post_meta($post->ID, 'Repo', true))
- $links = $links . 'Repo ';
- if ($meta = get_post_meta($post->ID, 'Licence', true))
- $links = $links . 'Licence ';
- return $content . $links;
- } elseif ($post->post_type == "writing") {
- if ($meta = get_post_meta($post->ID, 'Link', true))
- $links = $links . 'Read ';
- if ($meta = get_post_meta($post->ID, 'Licence', true))
- $links = $links . 'Licence ';
- return $content . $links;
- } elseif ($post->post_type == "other") {
- if ($meta = get_post_meta($post->ID, 'Link', true))
- $links = $links . 'Download ';
- return $content . $links;
- }
- return $content;
+function omphaloskepsis_the_content( $content ) {
+ global $post;
+ if ( $post->post_type == 'program' ) {
+ if ( $meta = get_post_meta( $post->ID, 'Link', true ) ) {
+ $links = $links . 'Download ';
+ }
+ if ( $meta = get_post_meta( $post->ID, 'Documentation', true ) ) {
+ $links = $links . 'Documentation ';
+ }
+ if ( $meta = get_post_meta( $post->ID, 'Repo', true ) ) {
+ $links = $links . 'Repo ';
+ }
+ if ( $meta = get_post_meta( $post->ID, 'Licence', true ) ) {
+ $links = $links . 'Licence ';
+ }
+ if ( $meta = get_post_meta( $post->ID, 'MD5', true ) ) {
+ $links = $links . '
MD5 checksum: ' . $meta . '
';
+ }
+ return $content . $links;
+ } elseif ( $post->post_type == 'website' ) {
+ if ( $meta = get_post_meta( $post->ID, 'Link', true ) ) {
+ $links = $links . 'Visit ';
+ }
+ if ( $meta = get_post_meta( $post->ID, 'Repo', true ) ) {
+ $links = $links . 'Repo ';
+ }
+ if ( $meta = get_post_meta( $post->ID, 'Licence', true ) ) {
+ $links = $links . 'Licence ';
+ }
+ return $content . $links;
+ } elseif ( $post->post_type == 'writing' ) {
+ if ( $meta = get_post_meta( $post->ID, 'Link', true ) ) {
+ $links = $links . 'Read ';
+ }
+ if ( $meta = get_post_meta( $post->ID, 'Licence', true ) ) {
+ $links = $links . 'Licence ';
+ }
+ return $content . $links;
+ } elseif ( $post->post_type == 'other' ) {
+ if ( $meta = get_post_meta( $post->ID, 'Link', true ) ) {
+ $links = $links . 'Download ';
+ }
+ return $content . $links;
+ }
+ return $content;
}
-add_filter('the_content', 'omphaloskepsis_the_content', 10);
+add_filter( 'the_content', 'omphaloskepsis_the_content', 10 );
add_action( 'wp_enqueue_scripts', 'load_dashicons_front_end' );
function load_dashicons_front_end() {
- wp_enqueue_style( 'dashicons' );
+ wp_enqueue_style( 'dashicons' );
}
function display_companies() {
- echo '
';
- echo 'Organisation ';
- echo 'Children ';
- echo 'Associated Items ';
- echo ' ';
-
- if ($_POST['toplevel'] == "true") {
- // Gets all of the top-level company terms.
- $terms = apply_filters("taxonomy-images-get-terms", "", array('having_images' => false, 'taxonomy' => 'company', 'term_args' => array('parent' => 0)));
- $include = 1;
- } else {
- // Gets all of the company terms.
- $terms = apply_filters("taxonomy-images-get-terms", "", array('having_images' => false, 'taxonomy' => 'company',));
- $include = 0;
- }
-
- if(!empty($terms)) {
- foreach($terms as $term) {
- $term_children = get_term_children($term->term_id, "company");
-
- // 0 = Jobs
- // 1 = Blog Posts
- // 2 = Websites
- // 3 = Programs
- // 4 = Writings
- // 5 = Videos
- // 6 = Others
- // 7 = Qualifications
- // 8 = Awards
- $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');
- $term_items = array();
- $term_item_counts = array();
+ echo '
';
+ echo 'Organisation ';
+ echo 'Children ';
+ echo 'Associated Items ';
+ echo ' ';
-
-
- foreach ($post_types as $post_type) {
- $args = array(
- 'posts_per_page' => -1,
- 'post_type' => $post_type,
- 'tax_query' => array(
- array(
- 'taxonomy' => 'company',
- 'field' => 'slug',
- 'terms' => $term->slug,
- 'include_children' => $include,
- ),
- ),
- 'meta_query' => array(),
- );
-
- if ($_POST['currentjobs'] == "true" && $post_type == "job") {
- $args['meta_query'] = array(
- array(
- 'key' => 'end-date',
- 'compare' => 'NOT EXISTS',
- 'value' => '1',
- ),
- );
- }
-
- if ($_POST['showexpired'] != "true" && $post_type == "qualification") {
- $args['meta_query'] = array(
- array(
- 'key' => 'Expired',
- 'compare' => 'NOT EXISTS',
- 'value' => '1',
- ),
- );
- }
+ if ( $_POST['toplevel'] == 'true' ) {
+ // Gets all of the top-level company terms.
+ $terms = apply_filters(
+ 'taxonomy-images-get-terms',
+ '',
+ array(
+ 'having_images' => false,
+ 'taxonomy' => 'company',
+ 'term_args' => array( 'parent' => 0 ),
+ )
+ );
+ $include = 1;
+ } else {
+ // Gets all of the company terms.
+ $terms = apply_filters(
+ 'taxonomy-images-get-terms',
+ '',
+ array(
+ 'having_images' => false,
+ 'taxonomy' => 'company',
+ )
+ );
+ $include = 0;
+ }
- $posts = get_posts($args);
+ if ( ! empty( $terms ) ) {
+ foreach ( $terms as $term ) {
+ $term_children = get_term_children( $term->term_id, 'company' );
- array_push($term_items, $posts);
- array_push($term_item_counts, count($posts));
- }
-
- if(($_POST['job'] == "true" && $term_item_counts[0] > 0) ||
- ($_POST['post'] == "true" && $term_item_counts[1] > 0) ||
- ($_POST['website'] == "true" && $term_item_counts[2] > 0) ||
- ($_POST['program'] == "true" && $term_item_counts[3] > 0) ||
- ($_POST['writing'] == "true" && $term_item_counts[4] > 0) ||
- ($_POST['video'] == "true" && $term_item_counts[5] > 0) ||
- ($_POST['other'] == "true" && $term_item_counts[6] > 0) ||
- ($_POST['qualification'] == "true" && $term_item_counts[7] > 0) ||
- ($_POST['award'] == "true" && $term_item_counts[8] > 0)) {
- $imgURL = wp_get_attachment_image_src($term->image_id, 'full')[0];
- $bgImg = (!$imgURL) ? "" : " background-image: url(".strtok($imgURL, '?').");";
- $colour = get_term_meta($term->term_id, 'color', true);
- $colour = ($colour != "") ? $colour : "transparent";
-
- echo '
';
- echo '';
- echo '';
- echo ' ';
- echo ' ';
- echo ' ';
-
- echo '';
- echo '';
- echo ''.$term->name.'
';
- echo ' ';
- echo ' ';
-
- echo '';
- $num = (count($term_children) > 0) ? "" : "none";
- echo '';
- echo ' '.count($term_children);
- echo '
';
- echo ' ';
-
- echo '';
- $i = 0;
- foreach ($post_types as $post_type) {
- $num = ($term_item_counts[$i] > 0) ? "" : "none";
- echo '';
- echo ' '.$term_item_counts[$i];
- echo '
';
- $i++;
- };
- echo ' ';
- echo ' ';
-
- /*
- echo '';
- echo '';
- echo '';
- if (count($term_children) > 0) {
- echo '
';
- echo count($term_children).' ';
- echo '
';
- }
- echo '
';
-
- echo '';
- $i = 0;
- foreach ($post_types as $post_type) {
- if ($_POST[$post_type] == "true") {
- echo '
';
- echo $term_item_counts[$i].' ';
- echo '
';
- }
- $i++;
- }
- echo '
';
- if (!$imgURL) echo ''.$term->name.'
';
- echo ' ';
- echo ' ';
- */
- }
- }
- } else {
- echo '
No companies found
';
- }
+ // 0 = Jobs
+ // 1 = Blog Posts
+ // 2 = Websites
+ // 3 = Programs
+ // 4 = Writings
+ // 5 = Videos
+ // 6 = Others
+ // 7 = Qualifications
+ // 8 = Awards
+ $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' );
+ $term_items = array();
+ $term_item_counts = array();
- die();
+ foreach ( $post_types as $post_type ) {
+ $args = array(
+ 'posts_per_page' => -1,
+ 'post_type' => $post_type,
+ 'tax_query' => array(
+ array(
+ 'taxonomy' => 'company',
+ 'field' => 'slug',
+ 'terms' => $term->slug,
+ 'include_children' => $include,
+ ),
+ ),
+ 'meta_query' => array(),
+ );
+
+ if ( $_POST['currentjobs'] == 'true' && $post_type == 'job' ) {
+ $args['meta_query'] = array(
+ array(
+ 'key' => 'end-date',
+ 'compare' => 'NOT EXISTS',
+ 'value' => '1',
+ ),
+ );
+ }
+
+ if ( $_POST['showexpired'] != 'true' && $post_type == 'qualification' ) {
+ $args['meta_query'] = array(
+ array(
+ 'key' => 'Expired',
+ 'compare' => 'NOT EXISTS',
+ 'value' => '1',
+ ),
+ );
+ }
+
+ $posts = get_posts( $args );
+
+ array_push( $term_items, $posts );
+ array_push( $term_item_counts, count( $posts ) );
+ }
+
+ if ( ( $_POST['job'] == 'true' && $term_item_counts[0] > 0 ) ||
+ ( $_POST['post'] == 'true' && $term_item_counts[1] > 0 ) ||
+ ( $_POST['website'] == 'true' && $term_item_counts[2] > 0 ) ||
+ ( $_POST['program'] == 'true' && $term_item_counts[3] > 0 ) ||
+ ( $_POST['writing'] == 'true' && $term_item_counts[4] > 0 ) ||
+ ( $_POST['video'] == 'true' && $term_item_counts[5] > 0 ) ||
+ ( $_POST['other'] == 'true' && $term_item_counts[6] > 0 ) ||
+ ( $_POST['qualification'] == 'true' && $term_item_counts[7] > 0 ) ||
+ ( $_POST['award'] == 'true' && $term_item_counts[8] > 0 ) ) {
+ $imgURL = wp_get_attachment_image_src( $term->image_id, 'full' )[0];
+ $bgImg = ( ! $imgURL ) ? '' : ' background-image: url(' . strtok( $imgURL, '?' ) . ');';
+ $colour = get_term_meta( $term->term_id, 'color', true );
+ $colour = ( $colour != '' ) ? $colour : 'transparent';
+
+ echo '
';
+ echo '';
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+
+ echo '';
+ echo '';
+ echo '' . $term->name . '
';
+ echo ' ';
+ echo ' ';
+
+ echo '';
+ $num = ( count( $term_children ) > 0 ) ? '' : 'none';
+ echo '';
+ echo ' ' . count( $term_children );
+ echo '
';
+ echo ' ';
+
+ echo '';
+ $i = 0;
+ foreach ( $post_types as $post_type ) {
+ $num = ( $term_item_counts[ $i ] > 0 ) ? '' : 'none';
+ echo '';
+ echo ' ' . $term_item_counts[ $i ];
+ echo '
';
+ $i++;
+ };
+ echo ' ';
+ echo ' ';
+
+ /*
+ echo '';
+ echo '';
+ echo '';
+ if (count($term_children) > 0) {
+ echo '
';
+ echo count($term_children).' ';
+ echo '
';
+ }
+ echo '
';
+
+ echo '';
+ $i = 0;
+ foreach ($post_types as $post_type) {
+ if ($_POST[$post_type] == "true") {
+ echo '
';
+ echo $term_item_counts[$i].' ';
+ echo '
';
+ }
+ $i++;
+ }
+ echo '
';
+ if (!$imgURL) echo ''.$term->name.'
';
+ echo ' ';
+ echo ' ';
+ */
+ }
+ }
+ } else {
+ echo '
No companies found
';
+ }
+
+ die();
}
-add_action('wp_ajax_display_companies', 'display_companies');
-add_action('wp_ajax_nopriv_display_companies', 'display_companies');
+add_action( 'wp_ajax_display_companies', 'display_companies' );
+add_action( 'wp_ajax_nopriv_display_companies', 'display_companies' );
diff --git a/header.php b/header.php
index 106e608..e80dde8 100644
--- a/header.php
+++ b/header.php
@@ -1,40 +1,40 @@
class="no-js">
-
-
-
-
-
+
+
+
+
+
-
+
-
+
-
-
+
+