Support » Plugin: Front-end Editor » Suggestion: Testing for 0

  • Resolved C. Spencer Beggs

    (@spencerbeggs)


    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.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Suggestion: Testing for 0’ is closed to new replies.