Up-to-date
This commit is contained in:
parent
98ea090b9f
commit
1958efe40f
10 changed files with 185 additions and 100 deletions
|
@ -32,6 +32,7 @@ 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.
|
||||
global $themecolors;
|
||||
$themecolors['bg'] = '95b2bf';
|
||||
$themecolors['text'] = '2b0000';
|
||||
|
@ -281,7 +282,7 @@ function omphaloskepsis_scripts() {
|
|||
// Theme stylesheet.
|
||||
wp_enqueue_style( 'omphaloskepsis-style', get_stylesheet_uri() );
|
||||
|
||||
wp_enqueue_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css');
|
||||
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" );
|
||||
|
||||
|
@ -496,50 +497,94 @@ function omphaloskepsis_the_content($content) {
|
|||
|
||||
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' );
|
||||
}
|
||||
|
||||
function display_companies() {
|
||||
echo "<ul>";
|
||||
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 = Websites
|
||||
// 2 = Programs
|
||||
// 3 = Writings
|
||||
// 4 = Videos
|
||||
// 5 = Others
|
||||
// 6 = Qualifications
|
||||
// 7 = Awards
|
||||
// 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();
|
||||
|
||||
foreach ($post_types as $post_type) {
|
||||
$posts = get_posts(array( 'posts_per_page' => -1, 'post_type' => $post_type, 'tax_query' => array(array('taxonomy' => 'company', 'field' => 'slug', 'terms' => $term->slug))));
|
||||
$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['website'] == "true" && $term_item_counts[1] > 0) ||
|
||||
($_POST['program'] == "true" && $term_item_counts[2] > 0) ||
|
||||
($_POST['writing'] == "true" && $term_item_counts[3] > 0) ||
|
||||
($_POST['video'] == "true" && $term_item_counts[4] > 0) ||
|
||||
($_POST['other'] == "true" && $term_item_counts[5] > 0) ||
|
||||
($_POST['qualification'] == "true" && $term_item_counts[6] > 0) ||
|
||||
($_POST['award'] == "true" && $term_item_counts[7] > 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 : "var(--light)";
|
||||
$colour = ($colour != "") ? $colour : "transparent";
|
||||
|
||||
echo '<a href="'.esc_url(get_term_link($term, $term->taxonomy)).'">';
|
||||
echo '<li class="col-2 col-m-4" style="background-color: '.$colour.'; '.$bgImg.'">';
|
||||
|
@ -576,4 +621,4 @@ function display_companies() {
|
|||
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');
|
||||
|
|
Reference in a new issue