0

I write function in functions.php like this

function out() {
  $s = 'End of the post, thanks for reading';
  return $s;
}

add_filter('the_content','out');

and I expect this to be fetched at the end of the post, after entry content. But all it does is that post entry ( what the_content outputs) is not shown, and I only get 'End of the post, thanks for reading'.

What am I doing wrong?

2 Answers 2

1

Try this:

function out($content) {
  return $content . ' End of the post, thanks for reading';
}
add_filter( 'the_content', 'out' );
Sign up to request clarification or add additional context in comments.

2 Comments

thanks man this works. so I need every time to pass parameter to the function? And than return the same parameter?
1

Can you try this

function out($content) {
  $content .= '<br>End of the post, thanks for reading';
  return $content;
}

add_filter('the_content','out');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.