add content on posts plugin (2 posts)

  1. sunilgupta91
    Posted 1 year ago #

    I want to add some content or an internal link to each post in my blog, I know there are some plugins for this like

    But I dont want to use them as they will make my site slow, I already using so many plugins

    Could you please provide me a script to do this, I just want to add this

    <Link>Submit your story</link>

    Please guide me

  2. tormorten
    Posted 1 year ago #

    You could do this by adding this to your themes functions.php:

    add_filter( 'the_content', 'add_link_to_posts' );
    function add_link_to_posts( $content )  {
    	if( get_post_type() === 'post' ) {
    		$content .= '<a href="http://example.com">Submit your story</a>';
    	return $content;

Topic Closed

This topic has been closed to new replies.

About this Topic