1
0
mirror of https://github.com/ascribe/wp-theme synced 2024-12-23 01:30:09 +01:00
wp-theme/content-blog.php

58 lines
1.4 KiB
PHP
Raw Normal View History

<?php
global $post;
$title = get_the_title();
$fname = get_the_author_meta('first_name');
$lname = get_the_author_meta('last_name');
$full_name = '';
if( empty($fname)){
$full_name = $lname;
} elseif( empty( $lname )){
$full_name = $fname;
} else {
//both first name and last name are present
$full_name = "{$fname} {$lname}";
}
2015-10-02 01:48:59 +02:00
if (strlen($full_name) <= 0) {
$full_name = 'ascribe';
2015-10-02 01:48:59 +02:00
}
2015-11-02 11:18:22 +01:00
$url = get_the_permalink();
?>
<article <?php post_class(); ?>>
<h2><?php echo get_the_category_list(); ?></h2>
<?php echo "<h1><a href='{$url}'>{$title}</a></h1>" ?>
<div class="image">
<?php
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'blog-crop');
echo "<img src='{$thumb[0]}' alt='{$title} image'>";
}
?>
</div>
<div class="meta">
<?php echo get_avatar( get_the_author_email(), 'size here' ); ?>
<span class="author">by <?php echo $full_name; ?></span>
on <date><?php the_time( get_option( 'date_format' ) ); ?></date>
</div>
<main class="entry">
<?php
if ( ! is_singular() ) {
the_excerpt();
echo "<a href='{$url}'>Read More</a>";
} else {
the_content();
}
?>
</main>
</article>