How to put link in twenty fourteen theme?

I need to put link with image at the end of post page. What I am looking for is that at the end of each new post, I need to have small image with link that opens in a new window. How to do that? Thanks.

Topic theme-twenty-fourteen posts Wordpress

Category Web


There are many ways to do this... Two most popular ways would be:

Modifying the theme files

You can find the template file in your theme that is responsible for displaying these posts/pages and add your HTML code in it.

Use Template Hierarchy to find correct file.

Remember: You should NEVER modify theme files directly. If you do, your changes will be lost after the theme gets updated... You should create child theme instead and do your modifications there...

Using the_content filter

If you want to add some HTML code to the end of posts, then you can also use the_content filter.

function add_my_code_after_post_content( $content ) {
    if ( is_single() ) {
        $content .= "<div>My custom HTML code goes here</div>";
    }

    return $content;
}
add_filter( 'the_content', 'add_my_code_after_post_content' );

You can edit and put any content you want on "single.php" file in the theme folder.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.