- -
--
- -
- - - -diff --git a/web/app/themes/mitlib-news/functions.php b/web/app/themes/mitlib-news/functions.php index 5033f69e..13ebb4f7 100644 --- a/web/app/themes/mitlib-news/functions.php +++ b/web/app/themes/mitlib-news/functions.php @@ -68,6 +68,36 @@ function admin_styles() { } add_action( 'admin_head', 'Mitlib\News\admin_styles' ); +/** + * Remove parent theme page templates. + * + * The Parent theme includes a number of page templates which are meant for only + * one page, and which are not relevant to the News theme. This function removes + * those irrelevant templates from the list of available options shown to page + * editors within the News theme. + * + * @param array $page_templates The list of available page templates in the theme. + */ +function prune_inherited_templates( $page_templates ) { + unset( $page_templates['templates/page-featured-news.php'] ); + unset( $page_templates['templates/page-home.php'] ); + unset( $page_templates['templates/page-hours.php'] ); + unset( $page_templates['templates/page-location-2021.php'] ); + unset( $page_templates['templates/page-location.php'] ); + unset( $page_templates['templates/page-map-locations.php'] ); + unset( $page_templates['templates/page-study-spaces.php'] ); + + return $page_templates; +} +add_filter( 'theme_page_templates', 'Mitlib\News\prune_inherited_templates' ); + +/** + * ============================================================================ + * ============================================================================ + * These functions are defined here, without adding them via add_action. They + * may be called by the templates within the theme. + */ + /** * 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. diff --git a/web/app/themes/mitlib-news/templates/page-last-year.php b/web/app/themes/mitlib-news/templates/page-last-year.php deleted file mode 100644 index 63a137e5..00000000 --- a/web/app/themes/mitlib-news/templates/page-last-year.php +++ /dev/null @@ -1,158 +0,0 @@ -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 ) { - // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped -- not sure what it will take to escape this properly. - echo mb_substr( $subex, 0, $excut ); - // phpcs:enable -- Start scanning again. - } else { - return $subex; - } - echo '[...]'; - } else { - return $excerpt; - } -} - -?> - - -
- -
- - - -- -
-- = 50 ) && has_excerpt( $post->ID ) ) { - // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped -- need wp_kses for this. - echo excerpt( 30 ); - // phpcs:enable -- Start scanning again. - echo 'excertp greater then'; - - - } - - - ?> - - - -
-- -
-- -
-