• I would like to do sth. similar to what the Yoast SEO plugin does to the rss feed – add something like: The post ____link to posttitle___ was published on ___site___. to the end of each post. There is a plugin I would like to use called Bottom of every post. Any ideas what html code to put in there?
    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    Try it with something like this in your theme’s functions:

    add_filter('the_content', 'bottom_post_text');
    function bottom_post_text($content) {
    
    if(!is_admin() && !is_page()){
    	global $post;
    	if(isset($post->ID) && $post->ID){
    	$text = '<p>The post <a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a>';
    	$text .= ' was published on ' . get_bloginfo( 'name' ) . '</p>';
    	return $content . $text;
    	}
    	return $content;
    }
    return $content;
    }

    https://codex.www.ads-software.com/Plugin_API/Filter_Reference/the_content

    Thread Starter jeffhunzukio

    (@jeffhunzukio)

    My theme asked for the creation of custom-functions.php – your code in this file now displays on top of all pages… any ideas what to do?

    Moderator keesiemeijer

    (@keesiemeijer)

    Can you provide a link to a page demonstrating the problem?

    Thread Starter jeffhunzukio

    (@jeffhunzukio)

    I’ve already deleted this file to restore the old condition,
    well, if this doesn’t work no problem, many thanks for your help so far.
    Maybe there is an other way to “brand” a post?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to auto link to posttitle from within post?’ is closed to new replies.