Skip to content
Snippets Groups Projects
Commit d9b5c5cc authored by Jakob Moser's avatar Jakob Moser
Browse files

Merge branch '10-include-date-of-last-edit-on-pages' into 'master'

Include last modification date on pages and single posts

Closes #10

See merge request !21
parents f5f8323b 1fbc3924
No related branches found
Tags v1.4.0
1 merge request!21Include last modification date on pages and single posts
......@@ -61,7 +61,7 @@ get_header();
</div>
<footer>
<time><?php the_date(); ?></time>
<div class="published date"><time><?php the_date(); ?></time></div>
</footer>
</article>
<?php endwhile; ?>
......
<?php
/**
* Template for pages.
* Template for a page.
*
* A page has similar traits to an entry in an encyclopedia: It provides up-to-date
* information on a certain topic, which is not expected to cease its relevance. If
* it ever does, the page should be deleted (it may be kept in archives, of course,
* but only there). Links on a page should never be dead, if they do, they should be
* replaced without trace by functioning links.
*
* The author of a page is of little importance, so we do not display their name. The
* publication date is also mostly irrelevant (in the same way I don't usually care
* about in which version of the encyclopedia a particular entry was added).
* The date of the last modification is interesting, because it gives visitors a hint
* if it might be outdated (of course, that should never happen, but mistakes happen...).
*
* WordPress identifies this file by its name (which MUST be page.php).
*
* Pages make up the scaffolding of the website and can often be reached via the page's
* main navigation. They contain information that is not expected to cease its relevance
* and should be kept up to date.
* The publication date of a page is normally irrelevant, more interesting would be the date
* of the last edit. In this template, we simply display no author names and no dates.
*
* Posts, on the other hand, have an (often implicit) expiration date and are expected to
* cease to be relevant at some point in time. See single.php for more details.
*
* @see https://codex.wordpress.org/Theme_Development#Pages_.28page.php.29
*/
......@@ -33,7 +36,9 @@ get_header();
<div class="content">
<?php the_content(); ?>
</div>
<footer></footer>
<footer>
<div class="modified date">Zuletzt geändert: <time><?php the_modified_date(); ?></time></div>
</footer>
</article>
</main>
<?php get_footer(); ?>
<?php
/**
* Template for single posts.
* Template for a single post.
*
* WordPress identifies this file by its name (which MUST be single.php)
* and displays it whenever a single post is displayed.
*
* Posts are generally used to present a piece of information that is relevant
* during a certain timespan, like a news article. After that time, the contents
* during a certain timespan, like a news article or an announcement. After that time, the contents
* often lose most of its relevance, aren't updated anymore (even if it means information
* presented in a post stops to be accurate due to its old age) and kept only for
* archival purposes.
* Posts display an author and a post date.
*
* Pages, on the other hand, contain information that is always relevant and should
* always be kept up to date, see page.php for more.
* Posts have an announcement-like character, and announcements are nothing else then messages,
* and for messages, we generally care about the author, so we display it. We also display
* the publication date and the date of the last change.
*
* WordPress identifies this file by its name (which MUST be single.php).
*
* @see https://codex.wordpress.org/Theme_Development#Single_Post_.28single.php.29
*/
......@@ -36,8 +35,9 @@ get_header();
<?php the_content(); ?>
</div>
<footer>
<div class="post-meta-author"><?php the_author_meta('display_name'); ?></div>
<time><?php the_date(); ?></time>
<div class="author"><?php the_author_meta('display_name'); ?></div>
<div class="published date">Veröffentlicht: <time><?php the_date(); ?></time></div>
<div class="modified date <?php if(get_the_modified_date() !== get_the_date()) { echo 'different'; } ?>">Zuletzt geändert: <time><?php the_modified_date(); ?></time></div>
</footer>
</article>
</main>
......
......@@ -7,7 +7,7 @@
* Author: personads :: Maximilian Müller-Eberstein (ursprüngliche Version und Design); Jakob Moser (Code-Rewrite)
* Author URI: https://personads.me/
*
* Version: 1.3.3
* Version: 1.4.0
*
* License: GNU General Public License v3.0
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
......@@ -343,11 +343,15 @@ article .content img {
height: auto;
}
article footer time {
article footer .date {
font-size: 0.7em;
display: block;
}
article footer .different.modified.date {
font-weight: bold;
}
article .content h1,
article .content h2 {
margin: 0.25em 0em;
......@@ -602,7 +606,7 @@ main.list .content {
margin-top: 1.5em;
}
main.list footer time {
main.list footer .date {
position: absolute;
top: 0.5em;
right: 1em;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment