How to show author name only on a post – WordPress

This code should probably be a LOT smaller, but I can’t seem to figure it out.

This is what I want:

Read More
[when the visitor is on a post]
Written by: the magnificent author of this piece

[When the visitor is on anything else then a post] 
...... (nothing here)

Simply put:

This is the titel!!

Written by the magnificent author (I only want this to show on a post, not on > a page or any other page)

The text in the article is then shown here as normal. Regardless if
the author is shown or not.

This is the code I’ve got so far…

<?php

if (is_single() || is_page()) {
    while (have_posts()):
        the_post();

        # page + post
        wikiwp_get_thumbnail($post);

        # post only
        if (is_single()) {
?>
                            <?php
                            _e('<p>Written by:', 'wikiwp');
                            echo '&nbsp;';
                            the_author_posts_link();
                            ?>
<?php
        } else if (is_page()) {
Stuff that is shown when they are on a page
?>
<?php
        }
    endwhile;
} else {
The stuff that is shown when they are on anything else
?>
<?php
}
?>
The text of the article......

I’m pretty sure the code above doesn’t make any sense…. But my limited PHP experience isn’t really helping lol.

Related posts