#19484 closed defect (bug) (duplicate)
Shortcode skipping when using two different types for same keyword.
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 2.8 |
| Component: | Shortcodes | Keywords: | |
| Focuses: | Cc: |
Description
I am writing a shortcode that has an open and closed format. What I mean by that is: open format is when you use a short code to open and close the content. Example: "[highlight lang='HTML'] <some html> [/highlight]". Closed format is when you just use the shortcode without incorporating anything else. Example: "[highlight lang='HTML' name='test']" and it pulls the named script from the html database for highlighting. If you only use one format in a page, it does fine. But when you mix them, it does not properly work. For example:
[highlight lang='HTML' name='test'] <some html> [highlight lang='HTML'] <some html to be highlighted> [/highlight]
The above example will always remove any content from the first shortcode to the closure shortcode thinking that the closure is for the first shortcode only. The shortcode code should reset with the second shortcode defined and assume the first one does not have a closure shortcode. If you reverse the order of the shortcodes, it will work fine, but that is not always the usage case.
I have test this in 2.8 through 3.3 rc1. I also could not find anything like this reported in the existing tickets. Most likely no one has tried to do anything like this before. I guess I could make it more than one shortcode, but I like the flexibility of the this format.
Richard Guay
Duplicate of #10702 and #14481?
On the Codex: http://codex.wordpress.org/Shortcode_API#Unclosed_Shortcodes