<?php // single-post.php ?>
Bedac na stronie single-post mamy dostep do obiektu <b>$post</b>, z ktorego mozemy wyciagnac wszystkie informacje dotyczace postow, nie uzywajac przy tym petli.
<?php the_post(); ?>
<h2><?php the_title(); ?></h2>
<p><?php the_content(); ?></p>
<span>Data publikacji: <?php the_date(); ?> o <?php the_time(); ?></span>
<span>Autor publikacji: <?php the_author(); ?></span>
<span>Format postu: <?php echo get_post_format( $post->ID ); ?></span>
<span>Kategorie: </span>
<?php
$categories = get_the_category();
foreach ($categories as $category){
echo '<a href="'. get_category_link($category->term_id) . '">' . $category->name . '</a>' . ' ';
}
?>
<span>Tagi: </span>
<?php
$categories = get_the_tags();
foreach ($categories as $category){
echo '<a href="'. get_category_link($category->term_id) . '">' . $category->name . '</a>' . ' ';
}
?>
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.