Support » Plugin: Hide Title » Title comparison not working with some symbols – Suggested fix for the code

  • Hi, I had a problem with the plugin not working on some pages and after some time I found the solution and fixed it. I will share with you, so you can hopefully fix it and add it to the next update.

    The problem:
    When comparing the $content == $this->title for this example “Козметични продукти – VICHY / ВИШИ” (without the quotation marks) the dash symbol makes some problem and the result is not true therefore the function does not execute properly

    The solution:
    The comparison $content == $this->title in the wrap_title function should be replaced with strcmp($content, $this->title).
    Example:

    public function wrap_title( $content ){
    	if( $this->is_hidden() && strcmp($content, $this->title) && $this->afterHead ){
    		$content = '<span class="' . $this->slug . '">' . $content . '</span>';
    	}
    	return $content;
    } // wrap_title()
    • This topic was modified 3 years, 8 months ago by khkrustev.
  • The topic ‘Title comparison not working with some symbols – Suggested fix for the code’ is closed to new replies.