From fc98d6c23453085b864d9e7bc73a72993e0c0426 Mon Sep 17 00:00:00 2001 From: Matt Bernhardt Date: Thu, 16 Feb 2023 15:44:10 -0500 Subject: [PATCH 1/7] Copy-paste PHP templates from legacy theme This includes: - Page templates going into a templates/ directory - Base templates staying at the theme root - inc/ and lib/ folders holding partials and internal libraries - The definition of the excerpt() function in functions.php There are no code changes through this commit - this is copy-paste only, although as noted above some files are now in a new location. --- .../themes/mitlib-news/archive-bibliotech.php | 116 +++++ web/app/themes/mitlib-news/archive.php | 159 +++++++ web/app/themes/mitlib-news/author.php | 149 ++++++ web/app/themes/mitlib-news/category.php | 91 ++++ web/app/themes/mitlib-news/content-single.php | 82 ++++ web/app/themes/mitlib-news/functions.php | 21 + web/app/themes/mitlib-news/inc/bib-header.php | 66 +++ web/app/themes/mitlib-news/inc/catFooter.php | 20 + web/app/themes/mitlib-news/inc/entry.php | 19 + web/app/themes/mitlib-news/inc/events.php | 52 +++ web/app/themes/mitlib-news/inc/footer.php | 35 ++ .../mitlib-news/inc/header-opengraph.php | 48 ++ web/app/themes/mitlib-news/inc/image.php | 17 + web/app/themes/mitlib-news/inc/imageEvent.php | 21 + web/app/themes/mitlib-news/inc/more-posts.php | 17 + web/app/themes/mitlib-news/inc/related.php | 52 +++ web/app/themes/mitlib-news/inc/social.php | 38 ++ web/app/themes/mitlib-news/inc/spotlights.php | 52 +++ web/app/themes/mitlib-news/inc/sub-header.php | 137 ++++++ .../mitlib-news/inc/sub-headerSingle.php | 146 ++++++ .../mitlib-news/inc/subheader-exception.php | 51 +++ web/app/themes/mitlib-news/inc/subtitle.php | 13 + .../themes/mitlib-news/inc/subtitleEvents.php | 13 + web/app/themes/mitlib-news/inc/title.php | 30 ++ web/app/themes/mitlib-news/index.php | 165 +++++++ web/app/themes/mitlib-news/lib/cards.php | 430 ++++++++++++++++++ .../lib/classes/nav-menu-dropdown.php | 40 ++ web/app/themes/mitlib-news/search.php | 142 ++++++ web/app/themes/mitlib-news/searchform.php | 27 ++ web/app/themes/mitlib-news/sidebar.php | 17 + web/app/themes/mitlib-news/single.php | 217 +++++++++ .../templates/additionalPosts-archives.php | 123 +++++ .../templates/additionalPosts-biblio.php | 82 ++++ .../templates/additionalPosts-cat.php | 95 ++++ .../templates/additionalPosts-events.php | 87 ++++ .../templates/additionalPosts-news.php | 69 +++ .../templates/additionalPosts-search.php | 148 ++++++ .../mitlib-news/templates/additionalPosts.php | 88 ++++ .../templates/page-biblio-archive.php | 69 +++ .../mitlib-news/templates/page-bibliotech.php | 124 +++++ .../mitlib-news/templates/page-events.php | 182 ++++++++ .../mitlib-news/templates/page-last-year.php | 144 ++++++ .../mitlib-news/templates/page-news.php | 115 +++++ .../mitlib-news/templates/page-sidebar.php | 49 ++ .../mitlib-news/templates/page-subscribe.php | 106 +++++ web/app/themes/mitlib-news/templates/page.php | 82 ++++ .../mitlib-news/templates/rss-biblio.php | 77 ++++ .../mitlib-news/templates/rss-event.php | 78 ++++ .../mitlib-news/templates/test-template.php | 340 ++++++++++++++ 49 files changed, 4541 insertions(+) create mode 100644 web/app/themes/mitlib-news/archive-bibliotech.php create mode 100644 web/app/themes/mitlib-news/archive.php create mode 100644 web/app/themes/mitlib-news/author.php create mode 100644 web/app/themes/mitlib-news/category.php create mode 100644 web/app/themes/mitlib-news/content-single.php create mode 100644 web/app/themes/mitlib-news/inc/bib-header.php create mode 100644 web/app/themes/mitlib-news/inc/catFooter.php create mode 100644 web/app/themes/mitlib-news/inc/entry.php create mode 100644 web/app/themes/mitlib-news/inc/events.php create mode 100644 web/app/themes/mitlib-news/inc/footer.php create mode 100644 web/app/themes/mitlib-news/inc/header-opengraph.php create mode 100644 web/app/themes/mitlib-news/inc/image.php create mode 100644 web/app/themes/mitlib-news/inc/imageEvent.php create mode 100644 web/app/themes/mitlib-news/inc/more-posts.php create mode 100644 web/app/themes/mitlib-news/inc/related.php create mode 100644 web/app/themes/mitlib-news/inc/social.php create mode 100644 web/app/themes/mitlib-news/inc/spotlights.php create mode 100644 web/app/themes/mitlib-news/inc/sub-header.php create mode 100644 web/app/themes/mitlib-news/inc/sub-headerSingle.php create mode 100644 web/app/themes/mitlib-news/inc/subheader-exception.php create mode 100644 web/app/themes/mitlib-news/inc/subtitle.php create mode 100644 web/app/themes/mitlib-news/inc/subtitleEvents.php create mode 100644 web/app/themes/mitlib-news/inc/title.php create mode 100644 web/app/themes/mitlib-news/index.php create mode 100644 web/app/themes/mitlib-news/lib/cards.php create mode 100644 web/app/themes/mitlib-news/lib/classes/nav-menu-dropdown.php create mode 100644 web/app/themes/mitlib-news/search.php create mode 100644 web/app/themes/mitlib-news/searchform.php create mode 100644 web/app/themes/mitlib-news/sidebar.php create mode 100644 web/app/themes/mitlib-news/single.php create mode 100644 web/app/themes/mitlib-news/templates/additionalPosts-archives.php create mode 100644 web/app/themes/mitlib-news/templates/additionalPosts-biblio.php create mode 100644 web/app/themes/mitlib-news/templates/additionalPosts-cat.php create mode 100644 web/app/themes/mitlib-news/templates/additionalPosts-events.php create mode 100644 web/app/themes/mitlib-news/templates/additionalPosts-news.php create mode 100644 web/app/themes/mitlib-news/templates/additionalPosts-search.php create mode 100644 web/app/themes/mitlib-news/templates/additionalPosts.php create mode 100644 web/app/themes/mitlib-news/templates/page-biblio-archive.php create mode 100644 web/app/themes/mitlib-news/templates/page-bibliotech.php create mode 100644 web/app/themes/mitlib-news/templates/page-events.php create mode 100644 web/app/themes/mitlib-news/templates/page-last-year.php create mode 100644 web/app/themes/mitlib-news/templates/page-news.php create mode 100644 web/app/themes/mitlib-news/templates/page-sidebar.php create mode 100644 web/app/themes/mitlib-news/templates/page-subscribe.php create mode 100644 web/app/themes/mitlib-news/templates/page.php create mode 100644 web/app/themes/mitlib-news/templates/rss-biblio.php create mode 100644 web/app/themes/mitlib-news/templates/rss-event.php create mode 100644 web/app/themes/mitlib-news/templates/test-template.php 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..8a110f31 --- /dev/null +++ b/web/app/themes/mitlib-news/archive-bibliotech.php @@ -0,0 +1,116 @@ + $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..b385241d --- /dev/null +++ b/web/app/themes/mitlib-news/archive.php @@ -0,0 +1,159 @@ + + + + + + + + +
+
+ + + +
+
+ + + + +
+
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..4bd77a3d --- /dev/null +++ b/web/app/themes/mitlib-news/author.php @@ -0,0 +1,149 @@ + + + + + +
+ + +
+
+ + + +
+

' . 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..1a5b3c75 --- /dev/null +++ b/web/app/themes/mitlib-news/category.php @@ -0,0 +1,91 @@ + + + + +
+ +
+
+ ' . '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..8bcc9718 --- /dev/null +++ b/web/app/themes/mitlib-news/content-single.php @@ -0,0 +1,82 @@ + + +
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..3f951965 100644 --- a/web/app/themes/mitlib-news/functions.php +++ b/web/app/themes/mitlib-news/functions.php @@ -61,3 +61,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..004e435b --- /dev/null +++ b/web/app/themes/mitlib-news/inc/bib-header.php @@ -0,0 +1,66 @@ + + +
+
+ +
+

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..4150f8fe --- /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..8aaa79bc --- /dev/null +++ b/web/app/themes/mitlib-news/inc/entry.php @@ -0,0 +1,19 @@ + + +
+

+ + + +

+
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..1e3bb75c --- /dev/null +++ b/web/app/themes/mitlib-news/inc/events.php @@ -0,0 +1,52 @@ + + + + +
+ + + + + + + + + + + + + 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..f5595acf --- /dev/null +++ b/web/app/themes/mitlib-news/inc/footer.php @@ -0,0 +1,35 @@ + + +
+  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..4777e3ae --- /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..2ce94f5f --- /dev/null +++ b/web/app/themes/mitlib-news/inc/spotlights.php @@ -0,0 +1,52 @@ + + + +
'; + } +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..74449b89 --- /dev/null +++ b/web/app/themes/mitlib-news/inc/sub-header.php @@ -0,0 +1,137 @@ + + +
+
+
+
+ +

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..e17e9904 --- /dev/null +++ b/web/app/themes/mitlib-news/inc/sub-headerSingle.php @@ -0,0 +1,146 @@ + + +
+
+
+ + +

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..6d3a7366 --- /dev/null +++ b/web/app/themes/mitlib-news/inc/subheader-exception.php @@ -0,0 +1,51 @@ + + +
+ +
+ +
+ + + +

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..ee83f736 --- /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..535a6b04 --- /dev/null +++ b/web/app/themes/mitlib-news/index.php @@ -0,0 +1,165 @@ +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..000c9690 --- /dev/null +++ b/web/app/themes/mitlib-news/lib/cards.php @@ -0,0 +1,430 @@ +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..268208b8 --- /dev/null +++ b/web/app/themes/mitlib-news/lib/classes/nav-menu-dropdown.php @@ -0,0 +1,40 @@ + + * @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..f775f7cf --- /dev/null +++ b/web/app/themes/mitlib-news/single.php @@ -0,0 +1,217 @@ + + + + + + + + +
+
+
+
+ +
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/templates/additionalPosts-archives.php b/web/app/themes/mitlib-news/templates/additionalPosts-archives.php new file mode 100644 index 00000000..ec536f00 --- /dev/null +++ b/web/app/themes/mitlib-news/templates/additionalPosts-archives.php @@ -0,0 +1,123 @@ + + + + + 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..de5feb29 --- /dev/null +++ b/web/app/themes/mitlib-news/templates/additionalPosts-biblio.php @@ -0,0 +1,82 @@ + + + + + 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..bffe6438 --- /dev/null +++ b/web/app/themes/mitlib-news/templates/additionalPosts-cat.php @@ -0,0 +1,95 @@ + + + + + + $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..5d669b7a --- /dev/null +++ b/web/app/themes/mitlib-news/templates/additionalPosts-events.php @@ -0,0 +1,87 @@ + + + + + $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..4c4b394d --- /dev/null +++ b/web/app/themes/mitlib-news/templates/additionalPosts-news.php @@ -0,0 +1,69 @@ + + + + + + '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..f126d70e --- /dev/null +++ b/web/app/themes/mitlib-news/templates/additionalPosts-search.php @@ -0,0 +1,148 @@ + + +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..bcccf96e --- /dev/null +++ b/web/app/themes/mitlib-news/templates/additionalPosts.php @@ -0,0 +1,88 @@ + + + + + $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..7223c4ec --- /dev/null +++ b/web/app/themes/mitlib-news/templates/page-biblio-archive.php @@ -0,0 +1,69 @@ + +
+ +
+
+ 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..a0b44abd --- /dev/null +++ b/web/app/themes/mitlib-news/templates/page-bibliotech.php @@ -0,0 +1,124 @@ +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..dc4dd521 --- /dev/null +++ b/web/app/themes/mitlib-news/templates/page-events.php @@ -0,0 +1,182 @@ +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..4ef84120 --- /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..5e8d5c97 --- /dev/null +++ b/web/app/themes/mitlib-news/templates/page-sidebar.php @@ -0,0 +1,49 @@ + + + + +
+
+
+ + +
+ +
+ +
+ +
+ +

+ +
+ + + +
+ +
+ + + +
+ + + +
+ +
+
+ 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..a90919c2 --- /dev/null +++ b/web/app/themes/mitlib-news/templates/page-subscribe.php @@ -0,0 +1,106 @@ +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..ad8fad32 --- /dev/null +++ b/web/app/themes/mitlib-news/templates/page.php @@ -0,0 +1,82 @@ +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..1c94edfc --- /dev/null +++ b/web/app/themes/mitlib-news/templates/rss-biblio.php @@ -0,0 +1,77 @@ + $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..2d328ca6 --- /dev/null +++ b/web/app/themes/mitlib-news/templates/rss-event.php @@ -0,0 +1,78 @@ + $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..6e821581 --- /dev/null +++ b/web/app/themes/mitlib-news/templates/test-template.php @@ -0,0 +1,340 @@ + + + + + + +
+
+ + 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 . ''; + + } + ?> + + +
+
+
+ + +
+ + + + + + + + + +
+
+ +
+
+ + +
+ +
+
+ + + From 264904fb471afb26ca0753363b11485bf7880a1a Mon Sep 17 00:00:00 2001 From: Matt Bernhardt Date: Mon, 27 Mar 2023 10:28:22 -0400 Subject: [PATCH 2/7] Results of automated cleaning via PHPCBF The changes here should be solid - I've come to trust PHPCBF's processes. Most of the changes are likely for whitespace issues, like fixing code indenting and spacing requirements. --- .../themes/mitlib-news/archive-bibliotech.php | 48 +-- web/app/themes/mitlib-news/archive.php | 75 ++-- web/app/themes/mitlib-news/author.php | 89 +++-- web/app/themes/mitlib-news/category.php | 23 +- web/app/themes/mitlib-news/content-single.php | 28 +- web/app/themes/mitlib-news/functions.php | 6 +- web/app/themes/mitlib-news/inc/bib-header.php | 11 +- web/app/themes/mitlib-news/inc/catFooter.php | 10 +- web/app/themes/mitlib-news/inc/events.php | 33 +- web/app/themes/mitlib-news/inc/footer.php | 32 +- web/app/themes/mitlib-news/inc/image.php | 5 +- web/app/themes/mitlib-news/inc/imageEvent.php | 4 +- web/app/themes/mitlib-news/inc/spotlights.php | 45 +-- web/app/themes/mitlib-news/inc/sub-header.php | 10 +- .../mitlib-news/inc/sub-headerSingle.php | 36 +- .../mitlib-news/inc/subheader-exception.php | 8 +- web/app/themes/mitlib-news/inc/title.php | 10 +- web/app/themes/mitlib-news/lib/cards.php | 285 +++++++-------- .../lib/classes/nav-menu-dropdown.php | 39 +- web/app/themes/mitlib-news/search.php | 99 ++++-- web/app/themes/mitlib-news/single.php | 143 ++++---- .../templates/additionalPosts-archives.php | 100 +++--- .../templates/additionalPosts-biblio.php | 47 +-- .../templates/additionalPosts-cat.php | 66 ++-- .../templates/additionalPosts-events.php | 47 +-- .../templates/additionalPosts-news.php | 47 +-- .../templates/additionalPosts-search.php | 110 +++--- .../mitlib-news/templates/additionalPosts.php | 59 +-- .../templates/page-biblio-archive.php | 35 +- .../mitlib-news/templates/page-bibliotech.php | 56 +-- .../mitlib-news/templates/page-events.php | 210 +++++------ .../mitlib-news/templates/page-last-year.php | 99 +++--- .../mitlib-news/templates/page-news.php | 54 +-- .../mitlib-news/templates/page-sidebar.php | 5 +- .../mitlib-news/templates/page-subscribe.php | 21 +- web/app/themes/mitlib-news/templates/page.php | 13 +- .../mitlib-news/templates/rss-biblio.php | 25 +- .../mitlib-news/templates/rss-event.php | 9 +- .../mitlib-news/templates/test-template.php | 335 ++++++++++-------- 39 files changed, 1325 insertions(+), 1052 deletions(-) diff --git a/web/app/themes/mitlib-news/archive-bibliotech.php b/web/app/themes/mitlib-news/archive-bibliotech.php index 8a110f31..b85a98b1 100644 --- a/web/app/themes/mitlib-news/archive-bibliotech.php +++ b/web/app/themes/mitlib-news/archive-bibliotech.php @@ -37,7 +37,7 @@ function the_excerpt_max_charlength( $charlength ) { } else { return $subex; } - echo '[...]' ; + echo '[...]'; } else { return $excerpt; } @@ -53,8 +53,8 @@ function the_excerpt_max_charlength( $charlength ) {

' . get_the_date() . '' ); + if ( is_day() ) : + printf( __( 'Daily Archives: %s', 'twentytwelve' ), '' . 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() ) : @@ -62,47 +62,51 @@ function the_excerpt_max_charlength( $charlength ) { else : _e( 'Archives', 'twentytwelve' ); endif; - ?> + ?>

- +
- + - + ?> - +

- +


- +
- term_id ) . '">' . $category[0]->cat_name . ''; -} -?> + term_id ) . '">' . $category[0]->cat_name . ''; + } + ?>   
- + - +
diff --git a/web/app/themes/mitlib-news/archive.php b/web/app/themes/mitlib-news/archive.php index b385241d..f56604c3 100644 --- a/web/app/themes/mitlib-news/archive.php +++ b/web/app/themes/mitlib-news/archive.php @@ -24,9 +24,10 @@ ?> - - +if ( ( get_post_type( get_the_ID() ) == 'bibliotech' ) || ( cat_is_ancestor_of( 73, $cat ) or is_category( 73 ) ) ) { + ?> + + @@ -39,62 +40,75 @@
- + ?> -
+
post_type ) { the_field( 'external_link' ); -} else { echo get_post_permalink();} ?>"'> + onClick='location.href=" + post_type ) { + the_field( 'external_link' ); + } else { + echo get_post_permalink();} + ?> + "'> - + - + <?php the_title(); ?> - + - post_type ) { ?> + post_type ) { ?>

- +

- +

- + - + - + - + - +
- cat_name . '" title="' . $category[0]->cat_name . '" href="' . get_category_link( $category[0]->term_id ) . '">' . $category[0]->cat_name . ''; } - ?> + ?> @@ -102,9 +116,9 @@
- + - +
@@ -121,10 +135,11 @@ if ( $i > 7 ) { - get_template_part( 'inc/more-posts' ); + get_template_part( 'inc/more-posts' ); - } - ?> + } + ?> +
diff --git a/web/app/themes/mitlib-news/author.php b/web/app/themes/mitlib-news/author.php index 4bd77a3d..c5bedb43 100644 --- a/web/app/themes/mitlib-news/author.php +++ b/web/app/themes/mitlib-news/author.php @@ -14,7 +14,7 @@
-
+
+ if ( get_the_author_meta( 'description' ) ) : ?>
@@ -73,61 +73,80 @@ + while ( have_posts() ) : + the_post(); + $i ++; + ?> -
+
post_type ) { the_field( 'external_link' ); -} else { echo get_post_permalink();} ?>"'> + onClick='location.href=" + post_type ) { + the_field( 'external_link' ); + } else { + echo get_post_permalink();} + ?> + "'> - + - - <?php the_title();?> - + + <?php the_title(); ?> + - post_type ) { ?> + post_type ) { ?>

- +

- +

- + - + - + - + - -
- + +
+
"; - echo "
 Bibliotech"; - } else { - $category = get_the_category(); - $rCat = count( $category ); - $r = rand( 0, $rCat -1 ); - echo '' . $category[ $r ]->cat_name . ''; - } ?> + echo "
 Bibliotech"; + } else { + $category = get_the_category(); + $rCat = count( $category ); + $r = rand( 0, $rCat - 1 ); + echo '' . $category[ $r ]->cat_name . ''; + } + ?>
- +
@@ -141,8 +160,8 @@ -
-
+
+
diff --git a/web/app/themes/mitlib-news/category.php b/web/app/themes/mitlib-news/category.php index 1a5b3c75..d967735d 100644 --- a/web/app/themes/mitlib-news/category.php +++ b/web/app/themes/mitlib-news/category.php @@ -19,25 +19,28 @@
- ' . 'Category: ' . '' . single_cat_title( '', false ) . '' . '' ); - } ?> + ' . 'Category: ' . '' . single_cat_title( '', false ) . '' . '' ); + } + ?> + - + - + @@ -52,12 +55,12 @@
diff --git a/web/app/themes/mitlib-news/inc/subheader-exception.php b/web/app/themes/mitlib-news/inc/subheader-exception.php index 6d3a7366..be191301 100644 --- a/web/app/themes/mitlib-news/inc/subheader-exception.php +++ b/web/app/themes/mitlib-news/inc/subheader-exception.php @@ -24,11 +24,13 @@

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

diff --git a/web/app/themes/mitlib-news/inc/title.php b/web/app/themes/mitlib-news/inc/title.php index ee83f736..8d082ebf 100644 --- a/web/app/themes/mitlib-news/inc/title.php +++ b/web/app/themes/mitlib-news/inc/title.php @@ -10,21 +10,21 @@ post_type ) { -?> + ?>

- +

- + ?>

- diff --git a/web/app/themes/mitlib-news/lib/cards.php b/web/app/themes/mitlib-news/lib/cards.php index 000c9690..cfebdcb5 100644 --- a/web/app/themes/mitlib-news/lib/cards.php +++ b/web/app/themes/mitlib-news/lib/cards.php @@ -49,7 +49,7 @@ 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'; + $outerClasses .= ' third'; } // Default inner classes. $inner_classes = 'flex-item blueTop eventsBox render-confirm-' . $type . ' ' . check_image(); @@ -66,33 +66,33 @@ function render( $post, $i, $type ) { $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 = ""; + 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 = "" . - "' . - '' . - '
'; + // 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 = "" . - "' . - ''; + // Non-biliotech articles. + $category = get_the_category(); + $rCat = count( $category ); + $r = rand( 0, $rCat - 1 ); + $categoryMarkup = '' . $category[ $r ]->cat_name . ''; + $dateMarkup = "" . + "' . + ''; } -?> + ?>
@@ -116,7 +116,7 @@ function render( $post, $i, $type ) { - + ?> - + ?> - + ?>
- +
- + - - - - + + + + - - - + + + - - + + - + - +
- +
- + ?>
- +
post_type ) { ?> - - + + - - + + 0 ) { ?> - - + + - - - + + + - - - - + + + + - - + + - + - +
- +
+ ?>
- + ?>
- - + + 0 ) { ?> - - + + - - - + + + - - - - + + + + - - + + - + - +
- +
-" */ function renderFeatureCard( $i, $post ) { $card_url = lookup_url( $post ); -?> + ?> - 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 index 268208b8..e621419d 100644 --- a/web/app/themes/mitlib-news/lib/classes/nav-menu-dropdown.php +++ b/web/app/themes/mitlib-news/lib/classes/nav-menu-dropdown.php @@ -8,33 +8,32 @@ * @author Bill Erickson * @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 (`
    `) + function start_lvl( &$output, $depth ) { + $indent = str_repeat( "\t", $depth ); // don't output children opening tag (`
      `) } - function end_lvl(&$output, $depth){ - $indent = str_repeat("\t", $depth); // don't output children closing tag + function end_lvl( &$output, $depth ) { + $indent = str_repeat( "\t", $depth ); // don't output children closing tag } /** - * Start the element output. - * - * @param string $output Passed by reference. Used to append additional content. - * @param object $item Menu item data object. - * @param int $depth Depth of menu item. May be used for padding. - * @param array $args Additional strings. - * @return void - */ - function start_el(&$output, $item, $depth, $args) { - $url = '#' !== $item->url ? $item->url : ''; - $output .= '\n"; // replace closing with the option tag } -} \ No newline at end of file +} diff --git a/web/app/themes/mitlib-news/search.php b/web/app/themes/mitlib-news/search.php index 7a72d1b7..2b15f18d 100644 --- a/web/app/themes/mitlib-news/search.php +++ b/web/app/themes/mitlib-news/search.php @@ -20,11 +20,11 @@ - + - " . "Sorry, we didn't find anything matching your search. Please try a different search term." . '

      ' ; ?> + " . "Sorry, we didn't find anything matching your search. Please try a different search term." . '

      '; ?> @@ -35,83 +35,106 @@ publish; - while ( have_posts() ) : the_post(); -$L++; - ?> + $L = -1; + // $theLength = $count_posts->publish; + while ( have_posts() ) : + the_post(); + $L++; + ?> -
      +
      post_type ) { the_field( 'external_link' ); -} else { echo get_post_permalink();} ?>"'> + onClick='location.href=" + post_type ) { + the_field( 'external_link' ); + } else { + echo get_post_permalink();} + ?> + "'> - + - - <?php the_title(); ?> - + + <?php the_title(); ?> + - post_type ) { ?> + post_type ) { ?>

      - +

      - +

      - + - + - + - + - -
      - + +
      +
      "; - echo "
       Bibliotech"; ?> + echo "
       Bibliotech"; + ?> - +
      - cat_name . '" title="' . $category[ $r ]->cat_name . '" href="' . get_category_link( $category[ $r ]->term_id ) . '">' . $category[ $r ]->cat_name . ''; ?> + $r = rand( 0, $rCat - 1 ); + echo '' . $category[ $r ]->cat_name . ''; + ?>
      - +
      - +
      - +
7 ) { +if ( $L > 7 ) { - get_template_part( 'inc/more-posts' ); + get_template_part( 'inc/more-posts' ); - } ?> +} +?> + diff --git a/web/app/themes/mitlib-news/single.php b/web/app/themes/mitlib-news/single.php index f775f7cf..fa8cbc14 100644 --- a/web/app/themes/mitlib-news/single.php +++ b/web/app/themes/mitlib-news/single.php @@ -17,14 +17,18 @@ - - +if ( ( get_post_type( get_the_ID() ) == 'bibliotech' ) || ( cat_is_ancestor_of( 73, $cat ) or is_category( 73 ) ) ) { + ?> + +
- +
data-category="slug; ?>">
', '' ); ?> @@ -39,24 +43,28 @@ the_field( 'bauthor' ); } else { the_author_posts_link(); - } - ?> - + } + ?> + + + in - + ?> cat_name . '" title="' . $category[ $r ]->cat_name . '" href="' . get_category_link( $category[ $r ]->term_id ) . '">' . $category[ $r ]->cat_name . ''; - ?> + echo '' . $category[ $r ]->cat_name . ''; + ?>
@@ -70,13 +78,14 @@ - + ?>
- Event dateEvent date format( 'F j, Y' ); ?> - - - + + +
- + - + Start date is ' . $date_start . '
'; - echo '
End date is ' . $date_end . '
'; - } ?> + if ( 'exhibits' === $type_post || 'updates' === $type_post ) { + $date_start = get_field( 'date_start' ); + $date_end = get_field( 'date_end' ); + echo '
Start date is ' . $date_start . '
'; + echo '
End date is ' . $date_end . '
'; + } + ?>
@@ -170,41 +186,44 @@
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(); + $catName = $category[ $r ]->cat_name; + $currentPost = get_the_ID(); -$myCatId = $category[ $r ]->cat_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 ), -); + $args = array( + 'post_type' => array( 'post', 'bibliotech', 'spotlights' ), + 'cat' => $myCatId, + 'posts_per_page' => '3', + 'order' => 'DESC', + 'orderby' => 'date', + 'post__not_in' => array( $currentPost ), + ); ?>
+$i = 0; +foreach ( $myposts as $post ) : + setup_postdata( $post ); + ?> +wp_reset_postdata(); +?>
diff --git a/web/app/themes/mitlib-news/templates/additionalPosts-archives.php b/web/app/themes/mitlib-news/templates/additionalPosts-archives.php index ec536f00..7b93a301 100644 --- a/web/app/themes/mitlib-news/templates/additionalPosts-archives.php +++ b/web/app/themes/mitlib-news/templates/additionalPosts-archives.php @@ -23,21 +23,21 @@ $offset = htmlspecialchars( trim( $_GET['offset'] ) ); - if ( '' == $offset ) { - $offset = 10; - } +if ( '' == $offset ) { + $offset = 10; +} $limit = htmlspecialchars( trim( $_GET['limit'] ) ); - if ( '' == $limit ) { - $limit = 9; - } +if ( '' == $limit ) { + $limit = 9; +} $args = array( - 'post_type' => array( 'bibliotech' ), - 'post__not_in' => array( 'sticky_posts' ), - 'ignore_sticky_posts' => 1, + 'post_type' => array( 'bibliotech' ), + 'post__not_in' => array( 'sticky_posts' ), + 'ignore_sticky_posts' => 1, 'offset' => 10, 'posts_per_page' => $limit, 'order' => 'DESC', @@ -45,79 +45,99 @@ 'suppress_filters' => false, -); + ); $the_query = new WP_Query( $args ); -?> + ?>
post_count; -?> + // Removes button start. + $ajaxLength = $the_query->post_count; + ?> - + -have_posts() ) : ?> +have_posts() ) : ?> -have_posts() ) : $the_query->the_post(); -$theLength = $my_query->post_count; -$i++; -?> + have_posts() ) : + $the_query->the_post(); + $theLength = $my_query->post_count; + $i++; + ?> -
-
post_type ) { the_field( 'external_link' ); -} else { echo get_post_permalink();} ?>"'> +
" width="100%" height="111" class="img-responsive" alt=""/> - + if ( 0 === $i % 3 ) { + echo 'third '; } + ?> + col-xs-12 col-xs-B-6 col-sm-4 col-md-4 no-padding-left-mobile"> +
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 index de5feb29..68a6058a 100644 --- a/web/app/themes/mitlib-news/templates/additionalPosts-biblio.php +++ b/web/app/themes/mitlib-news/templates/additionalPosts-biblio.php @@ -23,21 +23,21 @@ $offset = htmlspecialchars( trim( $_GET['offset'] ) ); - if ( '' == $offset ) { - $offset = 10; - } +if ( '' == $offset ) { + $offset = 10; +} $limit = htmlspecialchars( trim( $_GET['limit'] ) ); - if ( '' == $limit ) { - $limit = 9; - } +if ( '' == $limit ) { + $limit = 9; +} $args = array( - 'post_type' => array( 'bibliotech' ), - 'post__not_in' => array( 'sticky_posts' ), - 'ignore_sticky_posts' => 1, + 'post_type' => array( 'bibliotech' ), + 'post__not_in' => array( 'sticky_posts' ), + 'ignore_sticky_posts' => 1, 'offset' => 10, 'posts_per_page' => $limit, 'order' => 'DESC', @@ -45,17 +45,17 @@ 'suppress_filters' => false, -); + ); $the_query = new WP_Query( $args ); -?> + ?> post_count; -?> + // Removes button start. + $ajaxLength = $the_query->post_count; + ?> - -have_posts() ) : ?> +have_posts() ) : ?> -have_posts() ) : $the_query->the_post(); - $o++; + while ( $the_query->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 index 5d669b7a..b525824d 100644 --- a/web/app/themes/mitlib-news/templates/additionalPosts-events.php +++ b/web/app/themes/mitlib-news/templates/additionalPosts-events.php @@ -21,15 +21,15 @@ 'post', 'meta_query' => array( - array( - 'key' => 'is_event', - 'value' => '1', - 'compare' => '=', - ), - array( - 'key' => 'event_date', - 'value' => date( 'Y-m-d' ), - 'compare' => '<', - 'type' => 'DATE', - ), + 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', + 'meta_value_num' => 'DESC', ), ); @@ -67,18 +67,19 @@ $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 ); + while ( $the_query->have_posts() ) : + $the_query->the_post(); + $o++; + renderEventCard( $o, $post ); endwhile; endif; diff --git a/web/app/themes/mitlib-news/templates/additionalPosts-news.php b/web/app/themes/mitlib-news/templates/additionalPosts-news.php index 4c4b394d..d9433262 100644 --- a/web/app/themes/mitlib-news/templates/additionalPosts-news.php +++ b/web/app/themes/mitlib-news/templates/additionalPosts-news.php @@ -11,14 +11,14 @@ - + -have_posts() ) : ?> +have_posts() ) : ?> -have_posts() ) : $the_query->the_post(); - $o++; -?> + while ( $the_query->have_posts() ) : + $the_query->the_post(); + $o++; + ?> -
+
post_type ) { the_field( 'external_link' ); -} else { echo get_post_permalink();} ?>"'> - - + onClick='location.href=" - <?php the_title(); ?> - + if ( ( '' != get_field( 'external_link' ) ) && 'spotlights' == $post->post_type ) { + the_field( 'external_link' ); + } else { + echo get_post_permalink();} + ?> + "'> + + + + <?php the_title(); ?> + -

- +

+

- + - + - + - -
- + +
+
"; - echo "
 Bibliotech"; ?> + echo "
 Bibliotech"; + ?> - +
- cat_name . '" title="' . $category[ $r ]->cat_name . '" href="' . get_category_link( $category[ $r ]->term_id ) . '">' . $category[ $r ]->cat_name . ''; ?> + $r = rand( 0, $rCat - 1 ); + echo '' . $category[ $r ]->cat_name . ''; + ?>
- +
- +
- $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, + 'posts_per_page' => $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 ); + $the_query = new WP_Query( $args ); -?> + ?> post_count; @@ -59,29 +59,32 @@ - + -have_posts() ) : ?> +have_posts() ) : ?> -have_posts() ) : $the_query->the_post(); -renderRegularCard( $o, $post ); -$o++; -?> + have_posts() ) : + $the_query->the_post(); + renderRegularCard( $o, $post ); + $o++; + ?> - +
- + while ( have_posts() ) : + the_post(); + ?>
- ', '' ); - if ( get_field( 'subtitle' ) ) { ?> + ', '' ); + if ( get_field( 'subtitle' ) ) { + ?>

@@ -35,30 +38,38 @@
- + + + +
+
+ + endif; + ?>
- + ?>

- diff --git a/web/app/themes/mitlib-news/templates/page-bibliotech.php b/web/app/themes/mitlib-news/templates/page-bibliotech.php index a0b44abd..32a99dea 100644 --- a/web/app/themes/mitlib-news/templates/page-bibliotech.php +++ b/web/app/themes/mitlib-news/templates/page-bibliotech.php @@ -34,25 +34,27 @@ ); $query2 = new WP_Query( $args ); if ( $query2->have_posts() ) : -while ( $query2->have_posts() ) : $query2->the_post(); ?> - + while ( $query2->have_posts() ) : + $query2->the_post(); + ?> + - + - + - + - + - + - +
@@ -61,25 +63,25 @@
9, - 'post__not_in' => get_option( 'sticky_posts' ), - 'ignore_sticky_posts' => 1, - 'post_type' => 'bibliotech', - 'orderby' => 'date', - 'order' => 'DESC', - 'suppress_filters' => false, + $args = array( + 'posts_per_page' => 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(); -?> + $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(); + ?> - +
@@ -91,7 +93,9 @@ get_template_part( 'inc/more-posts' ); - } ?> + } + ?> +