WordPress.org

Ready to get started?Download WordPress

Forums

Front-end Editor
[resolved] Suggestion: Testing for 0 (2 posts)

  1. C. Spencer Beggs
    Member
    Posted 3 years ago #

    Hi, scribu,

    I was using your plugin to output a rating from 0 to 10. When the rating was 0, however, the plugin was invoking the placeholder function due to PHP's handling of a string of 0 as empty. I hacked mine like so to output the value:

    protected function placehold( $content ) {
    		if ( empty( $content ) )
    			if ($content === '0') {
    				return $content;
    			} else {
    				$content = $this->placeholder();
    			}
    		return $content;
    	}

    I also hacked the version to output non-breaking space characters   instead of [empty]. Perhaps the output of the placeholder would be something the should be settable in the plugin options.

    Again, great plugin and thank you for the support.

  2. scribu
    Member
    Plugin Author

    Posted 3 years ago #

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic