Skip to content

Commit

Permalink
Merge pull request #139 from MITLibraries/pw-55
Browse files Browse the repository at this point in the history
Add tag template to News theme
  • Loading branch information
matt-bernhardt authored Sep 13, 2023
2 parents 2d9fad2 + 2c71816 commit 6b65d9e
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 70 deletions.
79 changes: 12 additions & 67 deletions web/app/themes/mitlib-news/content-single.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,85 +8,30 @@

namespace Mitlib\News;

$category = get_the_category();
$type_post = get_post_type();
$subtitle;
$type;
$category = get_the_category();
$type_post = get_post_type();
?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> data-category="<?php echo esc_attr( $category[0]->slug ); ?>">
<div class="title-page mySingle">
<?php if ( get_field( 'mark_as_new' ) === true ) : ?>
<span>New!</span>
<?php endif; ?>
<div class="title-page mySingle">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>


<div class="entry-meta">
<span class="author">
By <?php the_author_posts_link(); ?>
</span>
<span class="date-post">
<?php
echo ' on ';
the_date();
?>
</span>
<?php if ( has_category() ) : ?>
<span class="category-post">

<?php
$category = get_the_category();
?>




on <?php the_date(); ?>
</span>
<?php endif; ?>
</div><!-- .entry-meta -->
</div><!-- .title-page -->

<div class="entry-content mitContent">


<?php
the_content();
// Echo type of Feature, if Feature.
if ( 'features' === $type_post ) {
$type = get_field( 'feature_type' );
echo 'The feature type is' . esc_html( $type );
}
// Echo start/end dates, if they exist.
if ( 'exhibits' === $type_post || 'updates' === $type_post ) {
$date_start = get_field( 'date_start' );
$date_end = get_field( 'date_end' );
echo '<div>Start date is ' . esc_html( $date_start ) . '</div>';
echo '<div>End date is ' . esc_html( $date_end ) . '</div>';
}
?>


<?php

$date = \DateTime::createFromFormat( 'Ymd', get_field( 'event_date' ) );
// echo $date->format('d-m-Y');
// Check for events.
if ( 'post' == $type_post && 1 == get_field( 'is_event' ) ) {
?>

<div class="event"><span class="grey">Event date </span> <?php echo esc_html( $date->format( 'F, j Y' ) ); ?><span class="grey"> starting at</span> <?php echo esc_html( get_field( 'event_start_time' ) ); ?> <span class="grey">
<?php
if ( get_field( 'event_end_time' ) != '' ) {
?>
and ending at</span> <?php echo esc_html( get_field( 'event_end_time' ) ); } ?></div>


<?php
}
?>


</div><!-- .entry-content -->

<?php
the_content();

if ( 'post' == $type_post && 1 == get_field( 'is_event' ) ) {
get_template_part( 'inc/events' );
}
?>
</div>
</article><!-- #post-## -->
9 changes: 8 additions & 1 deletion web/app/themes/mitlib-news/style.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
Theme Name: MITlib News
Author: MIT Libraries
Version: 0.2.0
Version: 0.3.0
Description: A child theme of the MIT Libraries' parent, focused on News features and content.
Template: mitlib-parent
Expand Down Expand Up @@ -832,6 +832,9 @@ h2.grid {
padding: 0px;
padding-left: 8px;
}
.mitContent {
overflow: auto;
}
.mitContent h2, .mitContent h3, .mitContent h4 {
margin: 0px;
padding: 0px;
Expand Down Expand Up @@ -872,6 +875,10 @@ article {
padding-left: 20px;
padding-right: 20px
}
.tag article {
padding-top: 10px;
margin-bottom: 20px;
}
.classCheck:nth-child(n+4) {
display: none;
}
Expand Down
34 changes: 34 additions & 0 deletions web/app/themes/mitlib-news/tag.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* The template for displaying all content with a single tag.
*
* @package MITlib_News
* @since 0.3.0
*/

namespace Mitlib\News;

get_header();
?>

<?php get_template_part( 'inc/sub-header' ); ?>

<div id="content" role="main">
<?php if ( have_posts() ) : ?>
<div class="container container-fluid">
<div class="row">
<h1 class="lib-header">Tag: <strong><?php echo esc_html( single_tag_title( '', false ) ); ?></strong></h1>
<?php
while ( have_posts() ) :
the_post();
get_template_part( 'content', 'single' );
endwhile;
?>
<?php \Mitlib\Parent\content_nav( 'nav-below' ); ?>
</div>
</div>
<?php endif; ?>
</div><!-- #content -->

<div class="container">
<?php get_footer(); ?>
4 changes: 2 additions & 2 deletions web/app/themes/mitlib-parent/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ img.wp-smiley,
.nav-previous,
.previous-image {
float: left;
width: 50%;
width: 48%;
}
.meta-nav {
position: relative;
Expand All @@ -454,7 +454,7 @@ img.wp-smiley,
.next-image {
float: right;
text-align: right;
width: 50%;
width: 48%;
}
.nav-single + .comments-area,
#comment-nav-above {
Expand Down

0 comments on commit 6b65d9e

Please sign in to comment.