diff --git a/web/app/themes/mitlib-news/archive-bibliotech.php b/web/app/themes/mitlib-news/archive-bibliotech.php new file mode 100644 index 00000000..b85a98b1 --- /dev/null +++ b/web/app/themes/mitlib-news/archive-bibliotech.php @@ -0,0 +1,120 @@ + $charlength ) { + $subex = mb_substr( $excerpt, 0, $charlength - 5 ); + $exwords = explode( ' ', $subex ); + $excut = - ( mb_strlen( $exwords[ count( $exwords ) - 1 ] ) ); + if ( $excut < 0 ) { + echo mb_substr( $subex, 0, $excut ); + } else { + return $subex; + } + echo '[...]'; + } else { + return $excerpt; + } +} + + +?> + + +
+
+ +
+

+ ' . get_the_date() . '' ); + elseif ( is_month() ) : + printf( __( 'Monthly Archives: %s', 'twentytwelve' ), '' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentytwelve' ) ) . '' ); + elseif ( is_year() ) : + printf( __( 'Yearly Archives: %s', 'twentytwelve' ), '' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentytwelve' ) ) . '' ); + else : + _e( 'Archives', 'twentytwelve' ); + endif; + ?> +

+
+ +
+ +
+ + + + + +

+ +

+
+
+ +
+
+ term_id ) . '">' . $category[0]->cat_name . ''; + } + ?> +    + + +
+
+ + + + + +
+ + +
+ +
+ + + + diff --git a/web/app/themes/mitlib-news/archive.php b/web/app/themes/mitlib-news/archive.php new file mode 100644 index 00000000..f56604c3 --- /dev/null +++ b/web/app/themes/mitlib-news/archive.php @@ -0,0 +1,174 @@ + + + + + + + + +
+
+ + + +
+
+ + + + +
+
post_type ) { + the_field( 'external_link' ); + } else { + echo get_post_permalink();} + ?> + "'> + + + + + + + + <?php the_title(); ?> + + + + post_type ) { ?> +

+ +

+ +

+ +

+ + + + + + + + + + + + + + + +
+ cat_name . '" title="' . $category[0]->cat_name . '" href="' . get_category_link( $category[0]->term_id ) . '">' . $category[0]->cat_name . ''; + } + ?> + + + +
+
+
+ + + + + +
+ +
+
+ +
+ + + + + + 7 ) { + + get_template_part( 'inc/more-posts' ); + + } + ?> + + + + + + +
+ diff --git a/web/app/themes/mitlib-news/author.php b/web/app/themes/mitlib-news/author.php new file mode 100644 index 00000000..c5bedb43 --- /dev/null +++ b/web/app/themes/mitlib-news/author.php @@ -0,0 +1,168 @@ + + + + + +
+ + +
+
+ + + +
+

' . get_the_author( '', false ) . '' ); ?>

+
+ + + + + + +
+
+ +
+
+

+

+
+
+ + + +
+ + + + + + + +
+
post_type ) { + the_field( 'external_link' ); + } else { + echo get_post_permalink();} + ?> + "'> + + + + + + <?php the_title(); ?> + + + + post_type ) { ?> +

+ +

+ +

+ +

+ + + + + + + + + + + +
+ +
"; + echo "
 Bibliotech"; + } else { + $category = get_the_category(); + $rCat = count( $category ); + $r = rand( 0, $rCat - 1 ); + echo '' . $category[ $r ]->cat_name . ''; + } + ?> + + +
+
+
+ +
+ + + + + + + +
+ + + + +
+
+
+ +
+ diff --git a/web/app/themes/mitlib-news/category.php b/web/app/themes/mitlib-news/category.php new file mode 100644 index 00000000..2326d481 --- /dev/null +++ b/web/app/themes/mitlib-news/category.php @@ -0,0 +1,96 @@ + + + + +
+ +
+
+ ' . 'Category: ' . '' . single_cat_title( '', false ) . '' . '' ); + } + ?> + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + +
+ diff --git a/web/app/themes/mitlib-news/content-single.php b/web/app/themes/mitlib-news/content-single.php new file mode 100644 index 00000000..76972ef7 --- /dev/null +++ b/web/app/themes/mitlib-news/content-single.php @@ -0,0 +1,90 @@ + + +
data-category="slug; ?>"> +
+ + New! + + ', '' ); ?> + + + +
+ +
+ + + Start date is ' . $date_start . '
'; + echo '
End date is ' . $date_end . '
'; + } + ?> + + + format('d-m-Y'); + // Check for events. + if ( 'post' == $type_post && 1 == get_field( 'is_event' ) ) { + ?> + +
Event date format( 'F, j Y' ); ?> starting at + + and ending at
+ + + + + +
+ + diff --git a/web/app/themes/mitlib-news/functions.php b/web/app/themes/mitlib-news/functions.php index cb9220fd..5033f69e 100644 --- a/web/app/themes/mitlib-news/functions.php +++ b/web/app/themes/mitlib-news/functions.php @@ -8,6 +8,12 @@ namespace Mitlib\News; +/** + * We use lib/cards.php to define a handful of functions which together + * render content in this theme in card format. + */ +require_once( 'lib/cards.php' ); + /** * Register and selectively enqueue stylesheets needed for the current page. */ @@ -61,3 +67,24 @@ function admin_styles() { } } add_action( 'admin_head', 'Mitlib\News\admin_styles' ); + +/** + * This function trims a WP excerpt at a word limit defined by $limit. If no + * limit (or a negative number) is received, the entire excerpt is returned. + * + * @param int $limit The number of words requested. + */ +function excerpt( $limit = 0 ) { + $excerpt = get_the_excerpt(); + if ( $limit > 0 ) { + $excerpt = explode( ' ', get_the_excerpt(), $limit ); + if ( count( $excerpt ) >= $limit ) { + array_pop( $excerpt ); + $excerpt = implode( ' ', $excerpt ) . '...'; + } else { + $excerpt = implode( ' ', $excerpt ); + } + } + $excerpt = preg_replace( '`\[[^\]]*\]`', '', $excerpt ); + return $excerpt; +} diff --git a/web/app/themes/mitlib-news/inc/bib-header.php b/web/app/themes/mitlib-news/inc/bib-header.php new file mode 100644 index 00000000..141a1eb5 --- /dev/null +++ b/web/app/themes/mitlib-news/inc/bib-header.php @@ -0,0 +1,71 @@ + + +
+
+ +
+

A biannual newsletter published by the MIT Libraries

+
+
+ +term_id, + array( + 'order' => 'DESC', + ) +); +?> + +
+
+
+ + + + + + + + diff --git a/web/app/themes/mitlib-news/inc/catFooter.php b/web/app/themes/mitlib-news/inc/catFooter.php new file mode 100644 index 00000000..2f0a04ea --- /dev/null +++ b/web/app/themes/mitlib-news/inc/catFooter.php @@ -0,0 +1,20 @@ + + +
+ cat_name . '" href="' . get_category_link( $category[0]->term_id ) . '">' . $category[0]->cat_name . ''; + } + ?> + + +
diff --git a/web/app/themes/mitlib-news/inc/entry.php b/web/app/themes/mitlib-news/inc/entry.php new file mode 100644 index 00000000..9f653c6f --- /dev/null +++ b/web/app/themes/mitlib-news/inc/entry.php @@ -0,0 +1,21 @@ + + +
+

+ + + +

+
diff --git a/web/app/themes/mitlib-news/inc/events.php b/web/app/themes/mitlib-news/inc/events.php new file mode 100644 index 00000000..063b6992 --- /dev/null +++ b/web/app/themes/mitlib-news/inc/events.php @@ -0,0 +1,59 @@ + + + + +
+ + + + + + + + + + + + + format( 'F j, Y' ); ?> + + + + + + +
+ + diff --git a/web/app/themes/mitlib-news/inc/footer.php b/web/app/themes/mitlib-news/inc/footer.php new file mode 100644 index 00000000..835fc002 --- /dev/null +++ b/web/app/themes/mitlib-news/inc/footer.php @@ -0,0 +1,41 @@ + + +
+  Bibliotech
"; + } elseif ( ( get_post_type( get_the_ID() ) == 'bibliotech' ) && ( ! is_page_template( 'additionalPosts-biblio.php' ) ) ) { + echo "
"; + echo "
 Bibliotech"; + ?> + + + + + cat_name . '" title="' . $category[ $r ]->cat_name . '" href="' . get_category_link( $category[ $r ]->term_id ) . '">' . $category[ $r ]->cat_name . ''; + ?> + + + + +
diff --git a/web/app/themes/mitlib-news/inc/header-opengraph.php b/web/app/themes/mitlib-news/inc/header-opengraph.php new file mode 100644 index 00000000..68c06b53 --- /dev/null +++ b/web/app/themes/mitlib-news/inc/header-opengraph.php @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + +
+ <?php the_title(); ?> +
+ diff --git a/web/app/themes/mitlib-news/inc/imageEvent.php b/web/app/themes/mitlib-news/inc/imageEvent.php new file mode 100644 index 00000000..19b4296f --- /dev/null +++ b/web/app/themes/mitlib-news/inc/imageEvent.php @@ -0,0 +1,21 @@ + + + +
+
+ <?php the_title(); ?> +
+
+ diff --git a/web/app/themes/mitlib-news/inc/more-posts.php b/web/app/themes/mitlib-news/inc/more-posts.php new file mode 100644 index 00000000..bf49fcf6 --- /dev/null +++ b/web/app/themes/mitlib-news/inc/more-posts.php @@ -0,0 +1,17 @@ + + +
+ +
+ + +
+
diff --git a/web/app/themes/mitlib-news/inc/related.php b/web/app/themes/mitlib-news/inc/related.php new file mode 100644 index 00000000..3f766de9 --- /dev/null +++ b/web/app/themes/mitlib-news/inc/related.php @@ -0,0 +1,52 @@ + + + + + + + + + + + + +
here
diff --git a/web/app/themes/mitlib-news/inc/social.php b/web/app/themes/mitlib-news/inc/social.php new file mode 100644 index 00000000..7038056e --- /dev/null +++ b/web/app/themes/mitlib-news/inc/social.php @@ -0,0 +1,38 @@ + + + diff --git a/web/app/themes/mitlib-news/inc/spotlights.php b/web/app/themes/mitlib-news/inc/spotlights.php new file mode 100644 index 00000000..cec9c666 --- /dev/null +++ b/web/app/themes/mitlib-news/inc/spotlights.php @@ -0,0 +1,53 @@ + + + +
'; +} +if ( ( $field['choices'][ $value ] ) === 'Update' ) { + $featImg = '
'; +} +if ( ( $field['choices'][ $value ] ) === 'Featured resource' ) { + $featImg = '
'; +} +if ( ( $field['choices'][ $value ] ) === 'Featured collection' ) { + $featImg = '
'; +} +if ( ( $field['choices'][ $value ] ) === 'Featured service' ) { + $featImg = '
'; +} +if ( ( $field['choices'][ $value ] ) === 'Featured exhibit' ) { + $featImg = '
'; +} +if ( ( $field['choices'][ $value ] ) === 'Featured story' ) { + $featImg = '
'; +} +if ( ( $field['choices'][ $value ] ) === 'Featured video' ) { + $featImg = '
'; +} +if ( ( $field['choices'][ $value ] ) === 'In the media' ) { + $featImg = '
'; +} +if ( ( $field['choices'][ $value ] ) === 'Check it out' ) { + $featImg = '
'; +} +?> +post_type ) { ?> +
+ +post_type ) { ?> +
+ diff --git a/web/app/themes/mitlib-news/inc/sub-header.php b/web/app/themes/mitlib-news/inc/sub-header.php new file mode 100644 index 00000000..dbcc242d --- /dev/null +++ b/web/app/themes/mitlib-news/inc/sub-header.php @@ -0,0 +1,139 @@ + + +
+
+
+
+ +

News & events

+ +

News & events

+ +
+
+ + + + + +
+
+ + + +
+ + +
+ +
+ + + + diff --git a/web/app/themes/mitlib-news/inc/sub-headerSingle.php b/web/app/themes/mitlib-news/inc/sub-headerSingle.php new file mode 100644 index 00000000..65b9e548 --- /dev/null +++ b/web/app/themes/mitlib-news/inc/sub-headerSingle.php @@ -0,0 +1,148 @@ + + +
+
+
+ + +

News & events

+ + +

News & events + ' . ': ' . single_cat_title( '', false ) . '' ); + } + ?> + +

+ + + +
+ + + + + + + +
+
+
+
+ diff --git a/web/app/themes/mitlib-news/inc/subheader-exception.php b/web/app/themes/mitlib-news/inc/subheader-exception.php new file mode 100644 index 00000000..be191301 --- /dev/null +++ b/web/app/themes/mitlib-news/inc/subheader-exception.php @@ -0,0 +1,53 @@ + + +
+ +
+ +
+ + + +

News & events

+ + + +

News & events + + : ' . single_cat_title( '', false ) . '' ); + + } + ?> + +

+ + + +
+ + + + + +
+ +
+ diff --git a/web/app/themes/mitlib-news/inc/subtitle.php b/web/app/themes/mitlib-news/inc/subtitle.php new file mode 100644 index 00000000..d2ea2e6c --- /dev/null +++ b/web/app/themes/mitlib-news/inc/subtitle.php @@ -0,0 +1,13 @@ + + +

+ +

diff --git a/web/app/themes/mitlib-news/inc/subtitleEvents.php b/web/app/themes/mitlib-news/inc/subtitleEvents.php new file mode 100644 index 00000000..1f842c2d --- /dev/null +++ b/web/app/themes/mitlib-news/inc/subtitleEvents.php @@ -0,0 +1,13 @@ + + +

+ +

diff --git a/web/app/themes/mitlib-news/inc/title.php b/web/app/themes/mitlib-news/inc/title.php new file mode 100644 index 00000000..8d082ebf --- /dev/null +++ b/web/app/themes/mitlib-news/inc/title.php @@ -0,0 +1,30 @@ + + +post_type ) { + ?> +

+ +

+ +

+ +

+ diff --git a/web/app/themes/mitlib-news/index.php b/web/app/themes/mitlib-news/index.php new file mode 100644 index 00000000..bb0223b1 --- /dev/null +++ b/web/app/themes/mitlib-news/index.php @@ -0,0 +1,167 @@ +ID == $post->ID; + +/** + * The $post_count variable is used to record how many stories were loaded + * on the initial page load (since the number of sticky stories is variable). + * This is then passed to the pagination routine to ensure smooth progression + * from the first to second pages. + */ +$post_count = 0; + +get_header(); + +get_template_part( 'inc/sub-header' ); + +// This sets up the upper region of the list, for "Featured" posts. +?> +
+ + +
+ + +
+ +

Featured news

+ 7, + 'post__in' => $sticky, + 'post_type' => array( + 'spotlights', + 'bibliotech', + 'post', + ), + 'ignore_sticky_posts' => 1, + 'orderby' => 'post_date', + 'order' => 'DESC', + 'suppress_filters' => false, +); +$sticky_query = new \WP_Query( $args ); + +if ( $sticky_query->have_posts() ) : + $i = 1; // $i is a counter variable. + while ( $sticky_query->have_posts() ) : + $sticky_query->the_post(); + + if ( 1 == $i ) { + // The first card is rendered as a feature. + renderMobileCard( $i, $post ); + renderFeatureCard( $i, $post ); + } else { + // All other cards are rendered normally. + renderRegularCard( $i, $post ); + } + + $i++; + $post_count++; + + endwhile; + + // This resets the query. + wp_reset_postdata(); + wp_reset_query(); + +endif; +?> +
+
+
+ +
+ + +
+ + +
+ + 9, + 'post__not_in' => $sticky, + 'post_type' => array( + 'spotlights', + 'bibliotech', + 'post', + ), + 'ignore_sticky_posts' => 1, + 'orderby' => 'post_date', + 'order' => 'DESC', + 'suppress_filters' => false, +); + +$standard_query = new \WP_Query( $args ); + +if ( $standard_query->have_posts() ) : + // $theLength = $count_posts->publish; + $i = -1; + while ( $standard_query->have_posts() ) : + $standard_query->the_post(); + $i++; + renderRegularCard( $i, $post ); // --- CALLS REGULAR CARDS --- // + + $post_count++; + + endwhile; + + wp_reset_query(); // Restore global post data stomped by the_post(). + +endif; +?> +
+ + +
+ + + 6 ) { + get_template_part( 'inc/more-posts' ); +} //$i > 6 +?> + +
+ + + + + +
+ diff --git a/web/app/themes/mitlib-news/lib/cards.php b/web/app/themes/mitlib-news/lib/cards.php new file mode 100644 index 00000000..140f38ab --- /dev/null +++ b/web/app/themes/mitlib-news/lib/cards.php @@ -0,0 +1,437 @@ +post_type ) { + $url = get_field( 'external_link' ); + } elseif ( get_field( 'calendar_url' ) ) { + $url = get_field( 'calendar_url' ); + } + return $url; +} + +/** + * Render function + * + * @param object $post A WP post object. + * @param int $i The index of the post object in a list. + * @param string $type The type of post. + */ +function render( $post, $i, $type ) { + // Default outer classes. + $outerClasses = 'padding-right-mobile col-xs-12 col-xs-B-6 col-sm-4 col-md-4 col-lg-4'; + if ( 0 == $i % 3 ) { + $outerClasses .= ' third'; + } + // Default inner classes. + $inner_classes = 'flex-item blueTop eventsBox render-confirm-' . $type . ' ' . check_image(); + + // Inner onClick. + $card_url = lookup_url( $post ); + // Image handled by inc/card-image. + // Title handled by inc/card-title. + // Event handled by inc/events. + // Entry handled by inc/entry. + // Category. + $categoryClasses = 'category-post'; + $categoryMarkup = ''; + $dateMarkup = ''; + + /* + Not sure this check is needed + if ($post->post_type == 'bibliotech') { + $categoryClasses .= " Bibliotech"; + } + */ + if ( is_page( 'bibliotech-index' ) || ( is_page_template( 'additionalPosts-biblio.php' ) ) || ( is_category( 'bibliotech_issues' ) || ( is_tax() ) || is_page_template( 'additionalPosts-archives.php' ) ) ) { + // Bibliotech articles without icon. + $categoryMarkup = ""; + } elseif ( ( 'bibliotech' == $post->post_type ) && ( ! is_page_template( 'additionalPosts-biblio.php' ) ) ) { + // Bibliotech articles with icon. + $categoryMarkup = "
"; + $categoryMarkup .= "
 Bibliotech"; + $dateMarkup = "" . + "' . + '' . + '
'; + } else { + // Non-biliotech articles. + $category = get_the_category(); + $rCat = count( $category ); + $r = rand( 0, $rCat - 1 ); + $categoryMarkup = '' . $category[ $r ]->cat_name . ''; + $dateMarkup = "" . + "' . + ''; + } + ?> +
+
+ + + + + + + + + + + +
+ + +
+ +
+
+ + + + + + + + + + +
+
+ + +
+ + + + + + + + + + + + + + + + + + +
+ + + + +
+
+ + + + +
+
+ +
+ + + post_type ) { ?> + + + + + + + 0 ) { ?> + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+
+ +
+ + + + +
+
+ +
+ + + + + 0 ) { ?> + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+ + + + + + diff --git a/web/app/themes/mitlib-news/lib/classes/nav-menu-dropdown.php b/web/app/themes/mitlib-news/lib/classes/nav-menu-dropdown.php new file mode 100644 index 00000000..e621419d --- /dev/null +++ b/web/app/themes/mitlib-news/lib/classes/nav-menu-dropdown.php @@ -0,0 +1,39 @@ + + * @copyright Copyright (c) 2011, Bill Erickson + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License + */ + +class Walker_Nav_Menu_Dropdown extends Walker_Nav_Menu { + function start_lvl( &$output, $depth ) { + $indent = str_repeat( "\t", $depth ); // don't output children opening tag (`
+ + 7 ) { + + get_template_part( 'inc/more-posts' ); + +} +?> + + + + + + + + + + + +
+ diff --git a/web/app/themes/mitlib-news/searchform.php b/web/app/themes/mitlib-news/searchform.php new file mode 100644 index 00000000..78910b30 --- /dev/null +++ b/web/app/themes/mitlib-news/searchform.php @@ -0,0 +1,27 @@ + + + + + diff --git a/web/app/themes/mitlib-news/sidebar.php b/web/app/themes/mitlib-news/sidebar.php new file mode 100644 index 00000000..622d5c75 --- /dev/null +++ b/web/app/themes/mitlib-news/sidebar.php @@ -0,0 +1,17 @@ + + + diff --git a/web/app/themes/mitlib-news/single.php b/web/app/themes/mitlib-news/single.php new file mode 100644 index 00000000..fa8cbc14 --- /dev/null +++ b/web/app/themes/mitlib-news/single.php @@ -0,0 +1,236 @@ + + + + + + + + +
+
+
+
+ +
data-category="slug; ?>"> +
+ ', '' ); ?> + +

+ + + +
+
+ +
+ +
+ + + + + +
+ Event date + + + + + + + + + + + format( 'F j, Y' ); ?> + + + + + + +
+ + + For more about this event, please visit ' . esc_url( $calendar_url ) . ''; + } + ?> + + + + + + + + + + + + + + + + + Start date is ' . $date_start . '
'; + echo '
End date is ' . $date_end . '
'; + } + ?> +
+ +
+
+ +
+
+
+ +
+
More in cat_name . '" title="' . $category[ $r ]->cat_name . '" href="' . get_category_link( $category[ $r ]->term_id ) . '">' . $category[ $r ]->cat_name . ''; ?> +
+
+ + + + cat_name; + $currentPost = get_the_ID(); + + + $myCatId = $category[ $r ]->cat_ID; + + $args = array( + 'post_type' => array( 'post', 'bibliotech', 'spotlights' ), + 'cat' => $myCatId, + 'posts_per_page' => '3', + 'order' => 'DESC', + 'orderby' => 'date', + 'post__not_in' => array( $currentPost ), + ); + ?> + + +
+ + + + + +
+ + +
+ + +
+
+
+ diff --git a/web/app/themes/mitlib-news/style.css b/web/app/themes/mitlib-news/style.css index 2e9a6ebc..00053fc0 100644 --- a/web/app/themes/mitlib-news/style.css +++ b/web/app/themes/mitlib-news/style.css @@ -1,7 +1,7 @@ /* Theme Name: MITlib News Author: MIT Libraries -Version: 0.0.2 +Version: 0.1.0 Description: A child theme of the MIT Libraries' parent, focused on News features and content. Template: mitlib-parent diff --git a/web/app/themes/mitlib-news/templates/additionalPosts-archives.php b/web/app/themes/mitlib-news/templates/additionalPosts-archives.php new file mode 100644 index 00000000..740743e6 --- /dev/null +++ b/web/app/themes/mitlib-news/templates/additionalPosts-archives.php @@ -0,0 +1,145 @@ + + + + + array( 'bibliotech' ), + 'post__not_in' => array( 'sticky_posts' ), + 'ignore_sticky_posts' => 1, + 'offset' => 10, + 'posts_per_page' => $limit, + 'order' => 'DESC', + 'orderby' => 'date', + 'suppress_filters' => false, + + + ); + $the_query = new \WP_Query( $args ); + + + ?> +
+ + + post_count; + ?> + + + + + + + + +have_posts() ) : ?> + + have_posts() ) : + $the_query->the_post(); + $theLength = $my_query->post_count; + $i++; + ?> + + +
+
post_type ) { + the_field( 'external_link' ); + } else { + echo get_post_permalink();} + ?> + "'> + + <?php the_title(); ?> + + + +

+ +

+ + + + + + + + + + + + + +
+ cat_name . '" title="' . $category[ $r ]->cat_name . '" href="' . get_category_link( $category[ $r ]->term_id ) . '">' . $category[ $r ]->cat_name . ''; + ?> + + +
+
+
+ + + +
diff --git a/web/app/themes/mitlib-news/templates/additionalPosts-biblio.php b/web/app/themes/mitlib-news/templates/additionalPosts-biblio.php new file mode 100644 index 00000000..c0bea6b1 --- /dev/null +++ b/web/app/themes/mitlib-news/templates/additionalPosts-biblio.php @@ -0,0 +1,85 @@ + + + + + array( 'bibliotech' ), + 'post__not_in' => array( 'sticky_posts' ), + 'ignore_sticky_posts' => 1, + 'offset' => 10, + 'posts_per_page' => $limit, + 'order' => 'DESC', + 'orderby' => 'date', + 'suppress_filters' => false, + + + ); + $the_query = new \WP_Query( $args ); + + + ?> + + + post_count; + ?> + + + + + + + + +have_posts() ) : ?> + + have_posts() ) : + $the_query->the_post(); + $theLength = $my_query->post_count; + $i++; + ?> + + + + + + diff --git a/web/app/themes/mitlib-news/templates/additionalPosts-cat.php b/web/app/themes/mitlib-news/templates/additionalPosts-cat.php new file mode 100644 index 00000000..2d979798 --- /dev/null +++ b/web/app/themes/mitlib-news/templates/additionalPosts-cat.php @@ -0,0 +1,99 @@ + + + + + + $limit, + 'post_type' => 'post', + 'cat' => $categoryId, + 'offset' => 21, + 'post__not_in' => get_option( 'sticky_posts' ), + 'ignore_sticky_posts' => 1, + 'orderby' => 'date', + 'order' => 'DESC', + 'suppress_filters' => false, + + ); + + $the_query = new \WP_Query( $args ); + + // Removes button start. + $ajaxLength = $the_query->post_count; + ?> + + + + +have_posts() ) : ?> + + + have_posts() ) : + $the_query->the_post(); + $o++; + renderRegularCard( $o, $post ); // --- CALLS REGULAR CARDS --- // + ?> + + + + + + + + + + + diff --git a/web/app/themes/mitlib-news/templates/additionalPosts-events.php b/web/app/themes/mitlib-news/templates/additionalPosts-events.php new file mode 100644 index 00000000..6ac64407 --- /dev/null +++ b/web/app/themes/mitlib-news/templates/additionalPosts-events.php @@ -0,0 +1,90 @@ + + + + + $limit, + 'ignore_sticky_posts' => true, + 'offset' => 9, + + 'post_type' => 'post', + 'meta_query' => array( + array( + 'key' => 'is_event', + 'value' => '1', + 'compare' => '=', + ), + array( + 'key' => 'event_date', + 'value' => date( 'Y-m-d' ), + 'compare' => '<', + 'type' => 'DATE', + ), + ), + + 'meta_key' => 'event_date', + 'orderby' => array( + 'meta_value_num' => 'DESC', + ), + +); + + $the_query = new \WP_Query( $args ); + +// Removes button start. +$ajaxLength = $the_query->post_count; + +if ( $ajaxLength < $limit ) { + ?> + + have_posts() ) : + $o = -1; + while ( $the_query->have_posts() ) : + $the_query->the_post(); + $o++; + renderEventCard( $o, $post ); + endwhile; +endif; + +wp_reset_query(); // Restore global post data stomped by the_post(). + +?> diff --git a/web/app/themes/mitlib-news/templates/additionalPosts-news.php b/web/app/themes/mitlib-news/templates/additionalPosts-news.php new file mode 100644 index 00000000..8cffd194 --- /dev/null +++ b/web/app/themes/mitlib-news/templates/additionalPosts-news.php @@ -0,0 +1,74 @@ + + + + + + 'post', + 'post__not_in' => array( $sticky ), + 'posts_per_page' => $limit, + 'offset' => '10', + 'ignore_sticky_posts' => true, + 'order' => 'DESC', + 'orderby' => 'date', + 'meta_query' => array( + array( + 'key' => 'is_event', + 'value' => '1', + 'compare' => '!=', + 'type' => 'NUMERIC', + ), + ), + + ); + + $the_query = new \WP_Query( $args2 ); + ?> + + + have_posts() ) : ?> + have_posts() ) : + $the_query->the_post(); + ?> + + + + + + + diff --git a/web/app/themes/mitlib-news/templates/additionalPosts-search.php b/web/app/themes/mitlib-news/templates/additionalPosts-search.php new file mode 100644 index 00000000..0047e1bc --- /dev/null +++ b/web/app/themes/mitlib-news/templates/additionalPosts-search.php @@ -0,0 +1,178 @@ + + +set( 'is_search', true ); +} + +?> + + + $limit, +); + +foreach ( $query_args as $key => $string ) { + $query_split = explode( '=', $string ); + $search_args[ $query_split[0] ] = urldecode( $query_split[1] ); + if ( 'search' == $query_split[0] ) { + $search_args['s'] = urldecode( $query_split[1] ); + } +} // foreach + +$the_query = new \WP_Query( $search_args ); +// The set_search() function is defined above. +set_search( $the_query ); + + +// Removes button start. +$ajaxLength = $the_query->post_count; +?> + + + + + + +have_posts() ) : ?> + + + have_posts() ) : + $the_query->the_post(); + $o++; + ?> + + +
+
post_type ) { + the_field( 'external_link' ); + } else { + echo get_post_permalink();} + ?> + "'> + + + + <?php the_title(); ?> + + + +

+ +

+ + + + + + + + + + +
+ +
"; + echo "
 Bibliotech"; + ?> + + + +
+
+ cat_name . '" title="' . $category[ $r ]->cat_name . '" href="' . get_category_link( $category[ $r ]->term_id ) . '">' . $category[ $r ]->cat_name . ''; + ?> + + + +
+ + + +
+
+ + + + + diff --git a/web/app/themes/mitlib-news/templates/additionalPosts.php b/web/app/themes/mitlib-news/templates/additionalPosts.php new file mode 100644 index 00000000..db3be29c --- /dev/null +++ b/web/app/themes/mitlib-news/templates/additionalPosts.php @@ -0,0 +1,93 @@ + + + + + $limit, + 'post_type' => array( 'spotlights', 'bibliotech', 'post' ), + 'offset' => $offset, + 'post__not_in' => get_option( 'sticky_posts' ), + 'ignore_sticky_posts' => 1, + 'orderby' => 'date', + 'order' => 'DESC', + 'suppress_filters' => false, + + ); + + $the_query = new \WP_Query( $args ); + + + ?> +post_count; +?> + + + + + + +have_posts() ) : ?> + + + have_posts() ) : + $the_query->the_post(); + renderRegularCard( $o, $post ); + $o++; + ?> + + + + + + + + + diff --git a/web/app/themes/mitlib-news/templates/page-biblio-archive.php b/web/app/themes/mitlib-news/templates/page-biblio-archive.php new file mode 100644 index 00000000..030b6a16 --- /dev/null +++ b/web/app/themes/mitlib-news/templates/page-biblio-archive.php @@ -0,0 +1,80 @@ + +
+
+
+ + + +
+ ', '' ); + if ( get_field( 'subtitle' ) ) { + ?> +

+ +
+ +
+ +

+
+ +
+ + + + + +
+ +
+ + +

+ + +
+
+
+
+ diff --git a/web/app/themes/mitlib-news/templates/page-bibliotech.php b/web/app/themes/mitlib-news/templates/page-bibliotech.php new file mode 100644 index 00000000..1d34b7da --- /dev/null +++ b/web/app/themes/mitlib-news/templates/page-bibliotech.php @@ -0,0 +1,128 @@ +ID == $post->ID; +get_header(); ?> + + + + +
+ + +
+ 1, + 'post__in' => $sticky, + 'ignore_sticky_posts' => 1, + 'post_type' => 'bibliotech', + 'order' => 'DESC', + 'orderby' => 'date', + 'suppress_filters' => false, +); +$query2 = new WP_Query( $args ); +if ( $query2->have_posts() ) : + while ( $query2->have_posts() ) : + $query2->the_post(); + ?> + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + 9, + 'post__not_in' => get_option( 'sticky_posts' ), + 'ignore_sticky_posts' => 1, + 'post_type' => 'bibliotech', + 'orderby' => 'date', + 'order' => 'DESC', + 'suppress_filters' => false, + ); + $my_query = new WP_Query( $args ); + $m = -1; + // Getting length. + $theLength = $my_query->post_count; + while ( $my_query->have_posts() ) { + $m++; + $my_query->the_post(); + ?> + + + + +
+ + 8 ) { + + get_template_part( 'inc/more-posts' ); + + } + ?> + +
+ +
+ diff --git a/web/app/themes/mitlib-news/templates/page-events.php b/web/app/themes/mitlib-news/templates/page-events.php new file mode 100644 index 00000000..6a520b8a --- /dev/null +++ b/web/app/themes/mitlib-news/templates/page-events.php @@ -0,0 +1,184 @@ +ID == $post->ID; +get_header(); ?> + + + +
+ + -1, + 'ignore_sticky_posts' => true, + + 'post_type' => 'post', + 'meta_query' => array( + array( + 'key' => 'is_event', + 'value' => '1', + 'compare' => '=', + ), + array( + 'key' => 'event_date', + 'value' => date( 'Y-m-d' ), + 'compare' => '>=', + 'type' => 'DATE', + ), + ), + + 'meta_key' => 'event_date', + 'orderby' => array( + 'meta_value_num' => 'ASC', + ), + + ); + $the_future = new WP_Query( $future ); + $future_posts = (array) $the_future->posts; + + $past = array( + + 'posts_per_page' => 9, + 'ignore_sticky_posts' => true, + + 'post_type' => 'post', + 'meta_query' => array( + array( + 'key' => 'is_event', + 'value' => '1', + 'compare' => '=', + ), + array( + 'key' => 'event_date', + 'value' => date( 'Y-m-d' ), + 'compare' => '<', + 'type' => 'DATE', + ), + ), + + 'meta_key' => 'event_date', + 'orderby' => array( + 'meta_value_num' => 'DESC', + ), + + ); + + $the_past = new WP_Query( $past ); + $past_posts = (array) $the_past->posts; + + // Archived events tagged by "oldevents". + $archive = array( + + 'posts_per_page' => 9, + 'ignore_sticky_posts' => true, + + 'post_type' => 'post', + 'tag' => 'oldevents', + + 'orderby' => 'post_date', + + ); + $the_archive = new WP_Query( $archive ); + $archive_posts = (array) $the_archive->posts; + + ?> +
+

Upcoming classes & events

+ 0 ) { + $i = -1; + foreach ( $future_posts as $post ) { + $i++; + renderEventCard( $i, $post ); + } + } else { + ?> +

There are no upcoming classes or events at this time, but check back often.

+ +
+ + + +

Past classes & events

+
+ 0 ) { + $i = -1; + foreach ( $past_posts as $post ) { + $i++; + renderEventCard( $i, $post ); + } + } + ?> +
+ 8 ) { + get_template_part( 'inc/more-posts' ); + } + ?> + + + +
+ + + + + + + +
+ID == $post->ID; +get_header(); ?> + $charlength ) { + $subex = mb_substr( $excerpt, 0, $charlength - 5 ); + $exwords = explode( ' ', $subex ); + $excut = - ( mb_strlen( $exwords[ count( $exwords ) - 1 ] ) ); + if ( $excut < 0 ) { + echo mb_substr( $subex, 0, $excut ); + } else { + return $subex; + } + echo '[...]'; + } else { + return $excerpt; + } +} + +?> + + +
+
+
+ array( + + array( + + 'column' => 'post_date_gmt', + 'before' => '210 days ago', + + ), + array( + + 'column' => 'post_date_gmt', + 'after' => 'last year', + + ), + ), + ); + + $the_query = new WP_Query( $args ); + + + ?> + +
+ have_posts() ) : ?> + have_posts() ) : + $the_query->the_post(); + ?> +
+ + + + + +

+ +

+
+
+ +
+ +
     + + + +
+ + + + +
+ term_id ) . '">' . $category[0]->cat_name . ''; + } + ?> +   
+
+ + + + +

+ +

+ + + +
+ +
+ +
+ +
+ +
+ diff --git a/web/app/themes/mitlib-news/templates/page-news.php b/web/app/themes/mitlib-news/templates/page-news.php new file mode 100644 index 00000000..fc520f30 --- /dev/null +++ b/web/app/themes/mitlib-news/templates/page-news.php @@ -0,0 +1,115 @@ +ID == $post->ID; +get_header(); ?> + + + + + + +
+ + +
+ +

News

+ + 'post', + 'post__not_in' => array( $sticky ), + 'posts_per_page' => '9', + 'ignore_sticky_posts' => true, + 'order' => 'DESC', + 'orderby' => 'date', + 'meta_query' => array( + array( + 'key' => 'is_event', + 'value' => '1', + 'compare' => '!=', + 'type' => 'NUMERIC', + ), + ), + + ); + $the_query = new WP_Query( $args ); + ?> + have_posts() ) : + // $theLength = $count_posts->publish; + ?> + + + have_posts() ) : + $the_query->the_post(); + $i++; + renderRegularCard( $i, $post ); // --- CALLS REGULAR CARDS --- // + ?> + + + + + + + + + + +
+ + +
+ + + 6 ) { + get_template_part( 'inc/more-posts' ); + } + ?> + + + + + +
+ diff --git a/web/app/themes/mitlib-news/templates/page-sidebar.php b/web/app/themes/mitlib-news/templates/page-sidebar.php new file mode 100644 index 00000000..e742ac1c --- /dev/null +++ b/web/app/themes/mitlib-news/templates/page-sidebar.php @@ -0,0 +1,52 @@ + + + + +
+
+
+ + +
+ +
+ +
+ +
+ +

+ +
+ + + +
+ +
+ + + +
+ + + +
+ +
+
+ diff --git a/web/app/themes/mitlib-news/templates/page-subscribe.php b/web/app/themes/mitlib-news/templates/page-subscribe.php new file mode 100644 index 00000000..6b812b67 --- /dev/null +++ b/web/app/themes/mitlib-news/templates/page-subscribe.php @@ -0,0 +1,111 @@ +ID == $post->ID; + + + +get_header(); ?> +
+
+
+ + +

News & events

+ + +

News & events + ' . ': ' . single_cat_title( '', false ) . '' ); + } + ?> + +

+ + + +
+ + + + + +
+
+
+
+ + + + +
+
+ + + + +
+ +
+ +

post_title; ?>

+ +

post_title; ?>

+ +
+ + + + +
+ + +
+ + + +
+ +

+ + + +
+ + + +
+ + +
+ + + + + + + +
+
+
+ +
+ diff --git a/web/app/themes/mitlib-news/templates/page.php b/web/app/themes/mitlib-news/templates/page.php new file mode 100644 index 00000000..5857b499 --- /dev/null +++ b/web/app/themes/mitlib-news/templates/page.php @@ -0,0 +1,85 @@ +ID == $post->ID; + + + +get_header(); ?> + + + +
+
+ +
+
+ +
+ diff --git a/web/app/themes/mitlib-news/templates/rss-biblio.php b/web/app/themes/mitlib-news/templates/rss-biblio.php new file mode 100644 index 00000000..88d44dfd --- /dev/null +++ b/web/app/themes/mitlib-news/templates/rss-biblio.php @@ -0,0 +1,80 @@ + $length ) { + return ( preg_match( '/^(.*)\W.*$/', substr( $string, 0, $length + 1 ), $matches ) ? $matches[1] : substr( $string, 0, $length ) ) . $replacer; } + return $string; +} + + + +$args = array( + 'posts_per_page' => -1, + 'post__not_in' => get_option( 'sticky_posts' ), + 'ignore_sticky_posts' => 1, + 'post_type' => 'bibliotech', + 'orderby' => 'menu_order', + 'order' => 'ASC', + 'suppress_filters' => false, +); +$the_query = new WP_Query( $args ); +$lastpost = $numposts - 1; +header( 'Content-Type: application/rss+xml; charset=UTF-8' ); +echo ''; +?> + + + + MIT Libraries Bibliotech + //libraries.mit.edu/news/bibliotech-feed/ + Newsletter published by the MIT Libraries + en-us + post_date_gmt ) ); ?> + post_date_gmt ) ); ?> + hartman@mit.edu (Stephanie Hartman) +have_posts() ) : + $the_query->the_post(); + ?> + + + <?php echo get_the_title( $post->ID ); ?> + ID ); ?> + post_content, 500 ) . '

Keep on reading: ' . get_the_title( $post->ID ) . '' . ']]>'; ?>
+ post_date_gmt ) ); ?> + ID ); ?> +
+ +
+
diff --git a/web/app/themes/mitlib-news/templates/rss-event.php b/web/app/themes/mitlib-news/templates/rss-event.php new file mode 100644 index 00000000..2642433b --- /dev/null +++ b/web/app/themes/mitlib-news/templates/rss-event.php @@ -0,0 +1,81 @@ + $length ) { + return ( preg_match( '/^(.*)\W.*$/', substr( $string, 0, $length + 1 ), $matches ) ? $matches[1] : substr( $string, 0, $length ) ) . $replacer; } + return $string; +} + + + +$args = array( + 'post__not_in' => get_option( 'sticky_posts' ), + 'meta_key' => 'is_event', + 'orderby' => 'meta_value_num', + 'order' => 'DESC', + 'posts_per_page' => -1, + + +); +$the_query = new WP_Query( $args ); +$lastpost = $numposts - 1; +header( 'Content-Type: application/rss+xml; charset=UTF-8' ); +echo ''; +?> + + + + MIT Libraries Events + //libraries.mit.edu/news/events/ + The latest events from the MIT Libraries + en-us + post_date_gmt ) ); ?> + post_date_gmt ) ); ?> + hartman@mit.edu (Stephanie Hartman) +have_posts() ) : + $the_query->the_post(); + ?> + + + <?php echo get_the_title( $post->ID ); ?> + ID ); ?> + post_content, 500 ) . '

Keep on reading: ' . get_the_title( $post->ID ) . '' . ']]>'; ?>
+ post_date_gmt ) ); ?> + ID ); ?> +
+ +
+
diff --git a/web/app/themes/mitlib-news/templates/test-template.php b/web/app/themes/mitlib-news/templates/test-template.php new file mode 100644 index 00000000..e30393cb --- /dev/null +++ b/web/app/themes/mitlib-news/templates/test-template.php @@ -0,0 +1,391 @@ + + + + + + +
+
+ + 1, + 'post__in' => $sticky, + 'ignore_sticky_posts' => 1, + 'orderby' => 'menu_order', + 'order' => 'ASC', + 'suppress_filters' => false, + ); + $query2 = new WP_Query( $args ); + if ( $query2->have_posts() ) : + while ( $query2->have_posts() ) : + $query2->the_post(); + ?> + + +
+
+ + <?php the_title(); ?> +
+
+

+ + +
     + + + +
+ + + + + +
+

+ +

+
+
+ cat_name . '" href="' . get_category_link( $category[0]->term_id ) . '">' . $category[0]->cat_name . ''; + } + ?> +    + + +
+
+
+ + + + + + + + + + +
+ + + + 9, + 'post_type' => array( 'Spotlights', 'bibliotech', 'post' ), + 'post__not_in' => get_option( 'sticky_posts' ), + 'ignore_sticky_posts' => 1, + 'orderby' => 'menu_order', + 'order' => 'ASC', + 'suppress_filters' => false, + + ); + $the_query = new WP_Query( $args ); + + + ?> + + + + + + +
+ have_posts() ) : ?> + have_posts() ) : + $the_query->the_post(); + + + ?> +
+
post_type ) { + the_field( 'external_link' ); + } else { + echo get_post_permalink();} + ?> + "'> + post_type ) { ?> +
Featured collection
+ + post_type ) { ?> +
featured
+ + +
+ + + <?php the_title(); ?> +

+ + +
format( 'F, j Y' ); ?>     + + + +
+ + + +
+

+ = 50 ) && has_excerpt( $post->ID ) ) { + echo excerpt( 30 ); + echo 'excertp greater then'; + + + } + + + ?> + + + +

+
+ + + + + + +

+ + +
format( 'F, j Y' ); ?>     + + + +
+ + + +
+

+ +

+
+ + + + +

+ + + + + +
+ + format( 'F, j Y' ); ?>     + + + +
+ + + + + + +
+

+ +

+
+ + + +
+ + bilbiotech icon
"; + echo "
 Bibliotech"; + + + } else { + + + + $category = get_the_category(); + + + $rCat = count( $category ); + $r = rand( 0, $rCat - 1 ); + echo '' . $category[ $r ]->cat_name . ''; + + } + ?> + + +
+
+
+ + +
+ + + + + + + + + +
+
+ +
+
+ + +
+ +
+
+ + +