Hallo,
hab folgendes Problem, ich habe eine Seite „Home“ und eine Seite „News“ Wordpress soll nun die Seite „Home“ standardmäßig als Startseite anzeigen. Das klappt auch.
Ich habe dann ein neues Template erstellt, den Inhalt von der index.php dort hereinkopiert und das Template „Blog“ genannt und die Datei habe ich „post.php“ genannt.
Nun konnte ich also auch auf der Seite „News“ einstellen, dass das Standard Template „Blog“ sein soll.
So weit so gut, rufe ich denn Blog jetzt aber auf, wurden mir zwar meine 2 Blogeinträge angezeigt. Allerdings haben alle zwei den gleichen Titel wobei der Titel des zweitens Posts eigentlich „Lorem Ipsum“ heißen sollte.
Zudem erscheint dort noch ein blockquote Element, welches ich aber in der post.php entfernt hatte.
Das Ganze verwirrt mich gerade etwas. Weis da eventuell jemand einen Rat?
Hier nun der Quelltext beider Templates:
index.php
<?php get_header(); ?>
<?php get_sidebar(); ?>
<section class="content col_12 col">
<article>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h2>Das Leben im Fluss</h2>
<blockquote class="right">This is what a blockquote will look like, floated right.<br />Testing a second line inside the blockquote.</blockquote>
<p>Published on <?php the_time('m d Y'); ?> by <?php the_author(); ?></p>
<p><?php the_content(); ?></p>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
</article>
</article>
</section><!-- end content -->
<div class="clear" style="height:10px; border-bottom:1px solid #ccc;"></div>
</div><!-- end wrap -->
<?php get_footer(); ?>
</body>
</html>
Alles anzeigen
post.php
<?php /*
Template Name: Blog
*/
?>
<?php get_header(); ?>
<?php get_sidebar(); ?>
<section class="content col_12 col">
<article>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h2><p><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p></h2>
<p>Published on <?php the_time('m d Y'); ?> by <?php the_author(); ?></p>
<p><?php the_content(); ?></p>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
</article>
</article>
</section><!-- end content -->
<div class="clear" style="height:10px; border-bottom:1px solid #ccc;"></div>
</div><!-- end wrap -->
<?php get_footer(); ?>
</body>
</html>
Alles anzeigen
Liebe Grüße,
SyntaX