Add to the_content using add_filter and echo
-
I’m using the add_filter function to “the_content” to add specific content to specific pages. Right now I have everything being returned in the function. Basically:
add_filter('the_content', 'check_page'); function check_page($content) { if(is_page(MYPAGE)) { $content .= my_function(); } return $content; }
By doing it this way I have to return all the content in “my_function()” instead of echoing or printing it. Are there any drawbacks to doing the following instead:
function check_page($content) { return $content; if(is_page(MYPAGE)) { my_function(); } }
And echoing/printing the content instead of returning it through the function?
Thanks.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Add to the_content using add_filter and echo’ is closed to new replies.