Commit 0fdea519 authored by Jakob Moser's avatar Jakob Moser
Browse files

Move code for article into component file

parent d9b5c5cc
Loading
Loading
Loading
Loading

components/article.php

0 → 100644
+32 −0
Original line number Diff line number Diff line
<article>
    <header style="background-image:url('<?php if(has_post_thumbnail()) {
            // A header configured specifically for this article
            the_post_thumbnail_url();
        } else {
            // Fall back to the default header (which can be configured site-wide, so we can't hardcode the URL)
            header_image();
        } ?>')">
        <h1><?php the_title(); ?></h1>
    </header>
    <div class="content">
        <?php the_content(); ?>
    </div>
    <footer>
        <?php if($args["show_author"]): ?>
            <div class="author"><?php the_author_meta('display_name'); ?></div>
        <?php endif; ?>

        <?php if($args["show_published_date"]): ?>
            <div class="published date">Veröffentlicht: <time><?php the_date(); ?></time></div>
        <?php endif; ?>

        <?php if($args["show_modified_date"]):
            $different = "";
            if($args["show_published_date"] && get_the_modified_date() !== get_the_date()) {
                $different = "different";
            }
        ?>
            <div class="modified date <?php echo $different; ?>">Zuletzt geändert: <time><?php the_modified_date(); ?></time></div>
        <?php endif; ?>
    </footer>
</article>
 No newline at end of file
+8 −18
Original line number Diff line number Diff line
@@ -22,23 +22,13 @@
get_header();
?>
<main>
    <?php the_post(); ?>
    <article>
        <header style="background-image:url('<?php if(has_post_thumbnail()) {
                // A header configured specifically for this page
                the_post_thumbnail_url();
            } else {
                // Fall back to the default header (which can be configured site-wide, so we can't hardcode the URL)
                header_image();
            } ?>')">
            <h1><?php the_title(); ?></h1>
        </header>
        <div class="content">
            <?php the_content(); ?>
        </div>
        <footer>
            <div class="modified date">Zuletzt geändert: <time><?php the_modified_date(); ?></time></div>
        </footer>
    </article>
    <?php
        the_post();
        get_template_part("components/article", array(
            "show_author" => false,
            "show_published_date" => false,
            "show_modified_date" => true
        )); 
    ?>
</main>
<?php get_footer(); ?>
+8 −20
Original line number Diff line number Diff line
@@ -20,25 +20,13 @@
get_header();
?>
<main>
    <?php the_post(); ?>
    <article>
        <header style="background-image:url('<?php if(has_post_thumbnail()) {
                // A header configured specifically for this post
                the_post_thumbnail_url();
            } else {
                // Fall back to the default header (which can be configured site-wide, so we can't hardcode the URL)
                header_image();
            } ?>')">
            <h1><?php the_title(); ?></h1>
        </header>
        <div class="content">
            <?php the_content(); ?>
        </div>
        <footer>
            <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>
    <?php 
        the_post();
        get_template_part("components/article", array(
            "show_author" => true,
            "show_published_date" => true,
            "show_modified_date" => true
        )); 
    ?>
</main>
<?php get_footer(); ?>