Add all post types to experience view

This commit is contained in:
Ben Goldsworthy 2021-02-28 09:33:40 +00:00
parent 53fe8a42fb
commit 967a1ea2e0
3 changed files with 23 additions and 7 deletions

View File

@ -601,20 +601,22 @@ function display_companies() {
// 2 = Websites
// 3 = Programs
// 4 = Writings
// 5 = Videos
// 5 = Audiovisuals
// 6 = Others
// 7 = Qualifications
// 8 = Awards
// 9 = Appearances
$post_types = array(
'job',
'post',
'website',
'program',
'writing',
'video',
'audiovisual',
'other',
'qualification',
'award',
'appearance',
);
$dashicons = array(
'hammer',
@ -626,6 +628,7 @@ function display_companies() {
'archive',
'id',
'awards',
'id-alt',
);
$term_items = array();
$term_item_counts = array();
@ -674,7 +677,17 @@ function display_companies() {
}
// Oh dear.
if ( ( isset( $_POST['job'] ) && 'true' === $_POST['job'] && $term_item_counts[0] > 0 ) || ( isset( $_POST['post'] ) && 'true' === $_POST['post'] && $term_item_counts[1] > 0 ) || ( isset( $_POST['website'] ) && 'true' === $_POST['website'] && $term_item_counts[2] > 0 ) || ( isset( $_POST['program'] ) && 'true' === $_POST['program'] && $term_item_counts[3] > 0 ) || ( isset( $_POST['writing'] ) && 'true' === $_POST['writing'] && $term_item_counts[4] > 0 ) || ( isset( $_POST['video'] ) && 'true' === $_POST['video'] && $term_item_counts[5] > 0 ) || ( isset( $_POST['other'] ) && 'true' === $_POST['other'] && $term_item_counts[6] > 0 ) || ( isset( $_POST['qualification'] ) && 'true' === $_POST['qualification'] && $term_item_counts[7] > 0 ) || ( isset( $_POST['award'] ) && 'true' === $_POST['award'] && $term_item_counts[8] > 0 ) ) {
if ( ( isset( $_POST['job'] ) && 'true' === $_POST['job'] && $term_item_counts[0] > 0 ) ||
( isset( $_POST['post'] ) && 'true' === $_POST['post'] && $term_item_counts[1] > 0 ) ||
( isset( $_POST['website'] ) && 'true' === $_POST['website'] && $term_item_counts[2] > 0 ) ||
( isset( $_POST['program'] ) && 'true' === $_POST['program'] && $term_item_counts[3] > 0 ) ||
( isset( $_POST['writing'] ) && 'true' === $_POST['writing'] && $term_item_counts[4] > 0 ) ||
( isset( $_POST['audiovisual'] ) && 'true' === $_POST['audiovisual'] && $term_item_counts[5] > 0 ) ||
( isset( $_POST['other'] ) && 'true' === $_POST['other'] && $term_item_counts[6] > 0 ) ||
( isset( $_POST['qualification'] ) && 'true' === $_POST['qualification'] && $term_item_counts[7] > 0 ) ||
( isset( $_POST['award'] ) && 'true' === $_POST['award'] && $term_item_counts[8] > 0 ) ||
( isset( $_POST['appearance'] ) && 'true' === $_POST['appearance'] && $term_item_counts[9] > 0 )
) {
$img_url = wp_get_attachment_image_src( $term->image_id, 'full' ) [0];
$bg_img = ( ! $img_url ) ? '' : ' background-image: url(' . strtok( $img_url, '?' ) . ');';
$colour = get_term_meta( $term->term_id, 'color', true );

View File

@ -44,8 +44,8 @@ get_header(); ?>
<input type="checkbox" name="programs" id="programs">
<label for="writings">Writings <span class="dashicons dashicons-format-aside"></span></label>
<input type="checkbox" name="writings" id="writings">
<label for="videos">Videos <span class="dashicons dashicons-video-alt"></span></label>
<input type="checkbox" name="videos" id="videos">
<label for="audiovisuals">Audiovisuals <span class="dashicons dashicons-video-alt"></span></label>
<input type="checkbox" name="audiovisuals" id="audiovisuals">
<label for="other">Other <span class="dashicons dashicons-archive"></span></label>
<input type="checkbox" name="other" id="other">
<label for="qualifications">Qualifications <span class="dashicons dashicons-id"></span></label>
@ -54,6 +54,8 @@ get_header(); ?>
<input class="expired" type="checkbox" name="expired" id="expired">
<label for="awards">Awards <span class="dashicons dashicons-awards"></span></label>
<input type="checkbox" name="awards" id="awards">
<label for="appearances">Appearances <span class="dashicons dashicons-id-alt"></span></label>
<input type="checkbox" name="appearances" id="appearances">
</div>
</fieldset>
<br>
@ -122,11 +124,12 @@ get_header(); ?>
'website': $('#websites').is(':checked'),
'program': $('#programs').is(':checked'),
'writing': $('#writings').is(':checked'),
'video': $('#videos').is(':checked'),
'audiovisual': $('#audiovisuals').is(':checked'),
'other': $('#other').is(':checked'),
'qualification': $('#qualifications').is(':checked'),
'showexpired': $('#expired').is(':checked'),
'award': $('#awards').is(':checked'),
'appearance': $('#appearances').is(':checked'),
};
$.post("/wp-admin/admin-ajax.php", settings, function(response) {

View File

@ -199,7 +199,7 @@
</div>
</section>
<?php
$page_order = array( 'post', 'website', 'program', 'writing', 'video', 'other' );
$page_order = array( 'post', 'website', 'program', 'writing', 'audiovisual', 'other' );
foreach ( $page_order as $current_section ) {
$args['post_type'] = array( $current_section );
$i = 0;