diff --git a/web/app/plugins/mitlib-post-interviewees/src/class-interviewee.php b/web/app/plugins/mitlib-post-interviewees/src/class-interviewee.php index 1395dd4f..2f6bf776 100644 --- a/web/app/plugins/mitlib-post-interviewees/src/class-interviewee.php +++ b/web/app/plugins/mitlib-post-interviewees/src/class-interviewee.php @@ -27,13 +27,13 @@ public static function define() { 'labels' => $labels, 'description' => '', 'public' => true, - 'publicly_queryable' => false, + 'publicly_queryable' => true, 'show_ui' => true, 'show_in_rest' => false, 'rest_base' => '', 'rest_controller_class' => 'WP_REST_Posts_Controller', 'rest_namespace' => 'wp/v2', - 'has_archive' => false, + 'has_archive' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'delete_with_user' => false, @@ -43,7 +43,7 @@ public static function define() { 'map_meta_cap' => true, 'hierarchical' => false, 'can_export' => true, - 'rewrite' => true, + 'rewrite' => array( 'slug' => 'interviewees' ), 'query_var' => true, 'supports' => array( 'title', 'editor', 'custom-fields', 'revisions', 'thumbnail' ), 'taxonomies' => array( 'category', 'post_tag' ), diff --git a/web/app/themes/mitlib-child/archive-interviewee.php b/web/app/themes/mitlib-child/archive-interviewee.php new file mode 100644 index 00000000..40f68de1 --- /dev/null +++ b/web/app/themes/mitlib-child/archive-interviewee.php @@ -0,0 +1,114 @@ + -1, + 'post_type' => 'interviewee', + 'post_status' => 'publish', + 'meta_key' => 'sort-name', + 'orderby' => 'sort-name', + 'order' => 'ASC', +); +$interviewees = new \WP_Query( $interviewee_params ); + +$interview_params = array( + 'post_type' => 'interview', + 'posts_per_page' => -1, + 'orderby' => 'post_date', + 'order' => 'ASC', + 'post_status' => 'publish', +); +$interviews = new \WP_Query( $interview_params ); +?> + + + + + +
+ + + +
+ +
+ + have_posts() ) { ?> + +
+

Index of interviewees

+ +
+
+
Photo
+
Name
+
MIT affiliation
+
Music / professional work
+
Interview dates
+
+ + have_posts() ) { + $interviewees->the_post(); + $record_id = get_the_ID(); + $interviewee_name = get_the_title(); + $affiliation = get_field( 'mit-affiliation' ); + $work = get_field( 'music-professional-work' ); + ?> + +
+
+ '; + the_post_thumbnail( 'small' ); + echo ''; + } else { + echo ' '; + } + ?> +
+
+
MIT affiliation
+
Music / professional work
+
+ Interview dates + have_posts() ) { + echo '
    '; + while ( $interviews->have_posts() ) { + $interviews->the_post(); + $interview_title = get_the_title(); + if ( str_contains( $interview_title, $interviewee_name ) ) { + echo '
  • '; + echo get_the_date( 'n/j/Y' ); + echo '
  • '; + } + }; + echo '
'; + }; + ?> +
+
+ +
+ +
+ + +
+ +
+ +
+ + diff --git a/web/app/themes/mitlib-child/css/scss/interviewees.scss b/web/app/themes/mitlib-child/css/scss/interviewees.scss new file mode 100644 index 00000000..c7f24667 --- /dev/null +++ b/web/app/themes/mitlib-child/css/scss/interviewees.scss @@ -0,0 +1,108 @@ +.table { + display: table; + + .table-head { + font-weight: bold; + } + + .table-row { + display: table-row; + + .table-cell { + border-bottom: 1px solid #ddd; + display: table-cell; + vertical-align: top; + + .table-label { + display: none; + } + + img { + height: auto; + max-width: 100px; + width: 100px; + } + + span { + display: block; + margin: 10px 20px 10px 10px; + + &.null-image { + height: 100px; + } + + &.record-title { + font-size: 18px; + } + } + + ul { + margin: 10px 20px 10px 10px; + + li { + margin: 0; + list-style: none; + + &:before { + content: " "; + font-family: FontAwesome; + color: #338bc5; + font-size: 12px; + margin-left: -12px; + } + } + } + } + + &:nth-child(even) { + background-color: #f2f2f2; + } + } +} + + +@media (max-width: 768px) { + .table { + display: block; + + .table-head { + display: none; + } + + .table-row { + border-bottom: 1px solid #676767; + display: block; + padding: 15px 0; + + .table-cell { + border-bottom: none; + display: flex; + + .table-label { + display: block; + font-weight: bold; + width: 33%; + } + + + .table-value { + width: 66%; + } + + .table-value-only { + margin-left: 33%; + padding-left: 20px; + width: 66%; + } + + ul li:before { + margin-left: 0; + } + } + + &.table-head { + display: none; + } + } + } +} \ No newline at end of file diff --git a/web/app/themes/mitlib-child/css/scss/interviews.scss b/web/app/themes/mitlib-child/css/scss/interviews.scss index a7688c5d..50c23dd5 100644 --- a/web/app/themes/mitlib-child/css/scss/interviews.scss +++ b/web/app/themes/mitlib-child/css/scss/interviews.scss @@ -5,12 +5,30 @@ #titlebar { background: #f2f0f0; + .row-icon { + margin: 9px 9px 6px 9px; + } + .list-inline { - margin-top: 12px; + margin-bottom: 6px; + margin-top: 9px; &.links li { margin-right: 12px; } + + &.tags li, + &.categories li { + padding-left: 0; + + &:after { + content: ' | '; + } + + &:last-child:after { + content: ''; + } + } } .post-thumbnail { diff --git a/web/app/themes/mitlib-child/functions.php b/web/app/themes/mitlib-child/functions.php index 74c046c8..51d827fe 100644 --- a/web/app/themes/mitlib-child/functions.php +++ b/web/app/themes/mitlib-child/functions.php @@ -30,7 +30,8 @@ function child_scripts_styles() { wp_register_style( 'bootstrap', '//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css', array(), '3.0.0' ); wp_register_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css', array(), '4.6.0' ); wp_register_style( 'interviews', get_stylesheet_directory_uri() . '/css/build/interviews.css', array(), $theme_version ); - wp_register_style( 'child-style', get_stylesheet_uri(), array( 'parent-global' ), $theme_version ); + wp_register_style( 'interviewees', get_stylesheet_directory_uri() . '/css/build/interviewees.css', array(), $theme_version ); + wp_register_style( 'child-style', get_stylesheet_uri(), array( 'parent-global', 'dashicons' ), $theme_version ); // Then we register javascript libraries. wp_deregister_script( 'jquery' ); @@ -53,6 +54,11 @@ function child_scripts_styles() { wp_enqueue_style( 'interviews' ); wp_enqueue_script( 'youtube-iframe-api' ); } + + // Load the styles for the index of interviewees only on that archive. + if ( is_post_type_archive( 'interviewee' ) ) { + wp_enqueue_style( 'interviewees' ); + } } add_action( 'wp_enqueue_scripts', 'Mitlib\Child\child_scripts_styles' ); @@ -111,6 +117,8 @@ function theme_setup() { 'uploads' => true, ); add_theme_support( 'custom-header', $args ); + + add_image_size( 'small', 100, 100, true ); } add_action( 'after_setup_theme', 'Mitlib\Child\theme_setup' ); diff --git a/web/app/themes/mitlib-child/images/no-photo.png b/web/app/themes/mitlib-child/images/no-photo.png deleted file mode 100644 index be7cdafd..00000000 Binary files a/web/app/themes/mitlib-child/images/no-photo.png and /dev/null differ diff --git a/web/app/themes/mitlib-child/single-interview.php b/web/app/themes/mitlib-child/single-interview.php index 252e0198..838001c2 100644 --- a/web/app/themes/mitlib-child/single-interview.php +++ b/web/app/themes/mitlib-child/single-interview.php @@ -39,7 +39,7 @@ $interviewee_music = get_field( 'music-professional-work', $interviewee->ID ); $interviewee_mit = get_field( 'mit-affiliation', $interviewee->ID ); - $interviewee_thumbnail = 'No Photo'; + $interviewee_thumbnail = ''; if ( get_the_post_thumbnail( $interviewee->ID, 'thumbnail' ) ) { $interviewee_thumbnail = get_the_post_thumbnail( $interviewee->ID, 'thumbnail' ); } @@ -56,15 +56,15 @@ */ $query = array( 'post_type' => 'interview', - 'posts_per_page' => 10, + 'posts_per_page' => -1, 'orderby' => 'post_date', 'order' => 'ASC', 'post_status' => 'publish', 'meta_key' => 'interviewee', 'meta_query' => array( 'key' => 'interviewee', - 'value' => $interviewee->ID, - 'compare' => 'LIKE', + 'value' => serialize( array( strval( $interviewee->ID ) ) ), + 'compare' => '=', ), ); $related = new \WP_Query( $query ); @@ -75,7 +75,7 @@
-

+

@@ -99,22 +99,26 @@
- - +
+ + +
+
+ + +