DISQUS

Dan Cameron: Post Title in RSS comment feed plugin at Scattered

  • JaredB · 4 years ago
    Cool
  • Dan · 4 years ago
    Since I was trying to create the plugin exactly how I would have done it without the help of your plugin, I didn't understand one thing; echo and response. You used response to display the output and I used echo (like the hack), is that wrong? What is the difference?
  • Nate · 4 years ago
    I'm using it, thanks guys. I did move the echo (actually I changed it to a return) outside the if statement just in case is_post() and is_single() both return true and we don't execute that chunk of code. I don't know a lick about PHP and very little about wordpress so it might not matter but anyway, thanks.
  • JaredB · 4 years ago
    mine. I'm suing you for copyright violation.

    As for echo vs. return, it is kind of a matter of preference - the WP code itself uses both, kind of randomly. The difference is yours will always output when the code is run, whereas mine returns the string to the calling function, which in this case is the filter method for 'comment_author_rss', which is programed to add anything your filter method returns. Yours will work because even though it's not returning everything, it is echoing (outputting to the browser) as it processes.

    The advantage to doing return instead of echo is that if you want to use that method for something else (just to get the value, not write it) you could just reuse that method without making a new one.