WordPress.org

Ready to get started?Download WordPress

Forums

Being consequent (1 post)

  1. jdyndale
    Member
    Posted 7 years ago #

    This is just my opinion...

    I think it would be a good idea to be consequent in regards to how, i.e. the post template, tags operate. They should either ALL have the option of returning a string or displaying to the browser - or NONE of them should have the option and just default to one of the two.

    Obviously the choice is better.

    For instance, I was just now writing a tiny plug-in for my blog and I needed to get WP to return a string for the post title, URL and content. I couldn't get the content, as the the_content() tag doesn't provide the option to turn display off.

    In my opinion it's a kind of "best practice" to never print something out to the standard output directly from a function that's meant to be reusable. Always return the data in the most generic format available so the person using the function can decide how and where to display it.

Topic Closed

This topic has been closed to new replies.

About this Topic