Viewing 8 replies - 1 through 8 (of 8 total)
  • I noticed the same thing @lino4000 !
    To bad you’ve gotten no answer.

    If you write [span class=habla]Text[/span] the plugin adds the ” ” but in my case, maybe yours as well, I want to add two classes, like [span class=habla blabla]Text[/span] but that does not work, then habla gets the ” ” but the blabla class ends up outside of the quotations.

    Some support here would be great!

    The plugin don’t add the quotation mark, it’s wordpress that add it.
    The code of this plugin is deadly simple.
    I tried too to add to class for this one :
    <span class=”glyphicon glyphicon-bullhorn” aria-hidden=”true”></span>

    But I could do it by writing this :
    <span class=glyphicon aria-hidden=true><span class=glyphicon-bullhorn aria-hidden=true></span></span>

    If you find another turnaround, please share

    Plugin Author jabelone

    (@jabelone)

    Sorry for the very delayed reply, I forgot I had made this plugin! I’ll try to keep an eye on here and keep it updated where possible but I have little use for this plugin now. It was originally meant to just allow links to be placed in the title but it should have worked with any HTML. WordPress is a massively complicated beast when it comes to stuff like this.

    As @abumalick said this plugin is ridiculously simple – the readme file has more lines! This is both advantageous, and disadvantageous. The plugin does nothing else so shouldn’t really have bugs. However the other way of looking at it, is it doesn’t do anything fancy, so it could have unexpected results with different themes/plugins.

    What version of WordPress are you running?
    What other plugins are you using?
    What theme are you using?
    Does it still happen with the 2015 or 2016 theme?
    Does it still happen when you disable every other plugin?

    I’ve found that it occurs with any “space” or whitespace character inserted in there. It’s interesting that if you use ” ” it doesn’t mind it but of course you can’t use that to separate two classes.

    Plugin Author jabelone

    (@jabelone)

    For the time being, the workaround @abumalick suggested appears to work. You just have to add the second class as another span inside the current one and don’t use ” or ‘ in it. So for example:

    [span class=class1][span class=class2]Your Content[/span][/span]

    I don’t think that workaround will work in all CSS situations, so if it doesn’t then you’ll just have to live with one class for the time being.

    Here is a script that works :

    <?php
    function icon_widget_title( $title ) {
    //HTML tag opening/closing brackets
    $title = str_replace( '[', '', $title );
    // [test]
    $title = str_replace( 'camera-retro]', '<i class="fa fa-camera-retro"></i>', $title );
    return $title;
    }
    add_filter( 'widget_title', 'icon_widget_title' );

    You have to add the double quotes in your plugin to make this work.

    I made this for my use with glyphicons and font awesome, if someone need it.

    <?php
    function icon_widget_title( $title ) {
    //HTML tag opening/closing brackets
    	//$title = str_replace( '[', '', $title );
    	$stop = strpos($title, "]");
    	if ($stop){
    		$icon = substr($title, 1, $stop);
    		$title = '<span class="'.substr($title, 1, $stop).'" aria-hidden="true"></span>'.substr($title, $stop+1);
    	}
    	return $title;
    }
    add_filter( 'widget_title', 'icon_widget_title' );

    Without the bug:

    <?php
    function icon_widget_title( $title ) {
    	//Take the icon classes that is inside brackets and put it in a span tag
    	// Exemple [glyphicon glyphicon-bullhorn]My Title
    	//Or [fa fa-camera-retro]Widget Title
    	$stop = strpos($title, "]");
    	if ($stop){
    		$title = '<span class="'.substr($title, 1, $stop-1).'" aria-hidden="true"></span>'.substr($title, $stop+1);
    	}
    	return $title;
    }
    add_filter( 'widget_title', 'icon_widget_title' );

    Base of the script from:
    https://jasonbradley.me/bootstrap-icons-in-widget-titles/#comment-270661

    Plugin Author jabelone

    (@jabelone)

    Looks great, thanks for that. I’ll have a proper look (and try to implement) in a few days time as I’m quite busy at the moment.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘bug with quotation marks’ is closed to new replies.