Empty multiselect fields when using Shortcode in Posts
-
Hey there,
I think there’s a mistake in the “of-taxonomy-walker.php” file in line 196 which prevents the plugin to properly display multiselect fields when using the shortcode in WordPress Posts:
Change this
$link = "<option class=\"level-".$this->multidepth."\" value='".$cat_id."'$checked />".$pad.$cat_name;
To this:
$link = "<option class=\"level-".$this->multidepth."\" value='".$cat_id."'$checked >".$pad.$cat_name;
to make it work (i.e. delete the “/” before the closing “>” in the <option …> tag.My guess why this happens is: The WordPress engine probably auto-corrects the HTML in posts. Since “<option … />” in the outputted code “<option … />Item</option>”looks like a self-closing HTML code, it will be converted to “<option …></option>Item</option>” in the first step and then to “<option …></option>Item”, i.e. the second (supposedly useless) closing </option> will be deleted, which will hide the “Item” text in the rendered website. This does not happen when using the short code in an individual html widget in a sidebar, since WordPress probably don’t touches this kind of HTML and the browser seems to tolerate this mistake.
Best regards,
Matthias
- The topic ‘Empty multiselect fields when using Shortcode in Posts’ is closed to new replies.