Refactor notes

This commit is contained in:
Ben Goldsworthy 2021-02-14 13:27:53 +00:00
parent d92a493315
commit 23aab0f59e

View file

@ -28,6 +28,7 @@
<main id="post-body" class="body"> <main id="post-body" class="body">
<!-- Post Notes -->
<?php $date1 = strtotime( get_the_date( 'Y-m-d' ) ); ?> <?php $date1 = strtotime( get_the_date( 'Y-m-d' ) ); ?>
<?php $date2 = strtotime( gmdate( 'Y-m-d' ) ); ?> <?php $date2 = strtotime( gmdate( 'Y-m-d' ) ); ?>
<?php if ( has_category( 'series' ) || has_tag( 'ohwhatohjeez' ) || get_post_meta( get_the_ID(), 'Note(s)', true ) || get_post_meta( get_the_ID(), 'License', true ) || ( $date1 < $date2 - 31557600 ) ) : ?> <?php if ( has_category( 'series' ) || has_tag( 'ohwhatohjeez' ) || get_post_meta( get_the_ID(), 'Note(s)', true ) || get_post_meta( get_the_ID(), 'License', true ) || ( $date1 < $date2 - 31557600 ) ) : ?>
@ -71,24 +72,38 @@
echo '</li>'; echo '</li>';
} }
?> ?>
<?php if ( $date1 < $date2 - 31557600 ) : ?> <?php
<li>This piece was written over a year ago. It may no longer accurately reflect my views now, or may be factually outdated.</li> if ( 'quotes' != get_post_type( get_the_ID() ) ) :
<?php endif; ?> if ( $date1 < $date2 - 31557600 ) :
?>
<li>This piece was written over a year ago. It may no longer accurately reflect my views now, or may be factually outdated.</li>
<?php
endif;
else :
?>
<li>This is a collection of quotes that I have highlighted as interesting or potentially useful for a future write-up. No further context is provided at this stage, so readers are advised not to read too much into the content below.</li>
<?php
endif;
?>
<?php if ( has_tag( 'ohwhatohjeez' ) ) : ?> <?php if ( has_tag( 'ohwhatohjeez' ) ) : ?>
<li>This piece was originally written for my old site, Oh What? Oh Jeez! As such, it may not have transferred over properly and some images and links might be broken (and, to a lesser extent, my writing from years ago is about 80% run-on sentences).</li> <li>This piece was originally written for my old site, Oh What? Oh Jeez! As such, it may not have transferred over properly and some images and links might be broken (and, to a lesser extent, my writing from years ago is about 80% run-on sentences).</li>
<?php endif; ?> <?php endif; ?>
<?php <?php
$notes = get_post_meta( get_the_ID(), 'Note(s)', true ); $notes = get_post_meta( get_the_ID(), 'Note', false );
if ( $notes ) : if ( $notes ) :
?> foreach ( $notes as $note ) :
<li><?php echo wp_kses_post( $notes ); ?></li> ?>
<?php endif; ?> <li><?php echo wp_kses_post( $note ); ?></li>
<?php
endforeach;
endif;
?>
<?php <?php
$license = get_post_meta( get_the_ID(), 'License', true ); $license = get_post_meta( get_the_ID(), 'License', true );
if ( $license ) : if ( $license ) :
?> ?>
<li>This work is licensed under <?php echo esc_html( $license ); ?>. <a href="/2018/03/copywrong/">Sorry about that</a>.</li> <li>This work is licensed under <?php echo esc_html( $license ); ?>. <a href="/2018/03/copywrong/">Sorry about that</a>.</li>
@ -97,7 +112,8 @@
</ul> </ul>
</div> </div>
<?php endif; ?> <?php endif; ?>
<!-- /Post Notes -->
<?php <?php
if ( get_the_content() ) : if ( get_the_content() ) :
the_content(); the_content();
@ -138,7 +154,6 @@
<?php endif; ?> <?php endif; ?>
</section> </section>
<section id="post-links"> <section id="post-links">
<?php <?php
$int_links = get_post_meta( get_the_ID(), 'Internal_Link', false ); $int_links = get_post_meta( get_the_ID(), 'Internal_Link', false );