Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • Dennis Bareis
    Participant
    DEFINE: attribution_for_all_plant_photos_needing_it
    TO    : IMAGE SOURCE: %%text%%

    Using this in Image Description and Title when image used:
    [sc name="attribution_for_all_plant_photos_needing_it" text="Geekstreet, CC BY-SA 4.0 https://creativecommons.org/licenses/by-sa/4.0, via Wikimedia Commons"][/sc]

    It sort of works but it gets truncated at the comma (but also displays an extra double quote):
    IMAGE SOURCE: "Geekstreet,

    Title Attribute wrong, has double quote and truncated

    Am I hitting a limitation or quoting incorrectly?

    Hi Dennis,

    There is no restriction in the size of the custom parameter value.

    My guess is that the HTML syntax is disturbed because of some wrong double quote.

    Can you please “view page source” and check the HTML?
    Confirm if the full text is replaced.

    If yes, then it means that the tag is malformated. You might have to fix the syntax.

    I tried the example you shared and full text is replaced.

    Thanks,
    Aakash

    Dennis Bareis
    Participant

    Hi,

    I can copy paste the exact same shortcode into the page and it will work, it will not work when pasted into an images’s description field (and as mentioned Advanced, Title when referred to in a gallery).

    This is the output as shown by chrome’s debugger:

    <p><i>[AUTHOR’S LICENCE/RESUSE DETAILS]</i>
    <br>
    Licenced by 
    <a rel="noreferrer noopener" href="”https://commons.wikimedia.org/wiki/File:Starr_050815-3471_Wahlenbergia_gracilis.jpg" ”="" target="_blank" title="”Click" to="" see="" the="" original="" source="" image="" (in="" a="" new="" tab):="" ”https:="" commons.wikimedia.org="" wiki="" file:starr_050815-3471_wahlenbergia_gracilis.jpg””="">”Forest</a> 
    with the creative commons licence
    	<a rel="noreferrer noopener" href="https://creativecommons.org/licenses/by/3.0" target="_blank" title="”Click" to="" see="" complete="" licence="" details="" (in="" a="" new="" tab):="" https:="" creativecommons.org="" licenses="" by="" 3.0”="">CC BY 3.0</a></p>

    The first part is corrupted, the 2nd part (url etc) works. Apart from some truncation, notice the unicode “”” quote characters that were inserted.

    I do have another unrelated question, if you provide a default to a parameter at the definition, what happens on subsequent references that don’t provide a default (do they inherit the previously defined default value?).

    Hi Dennis,

    I guess you need to clean up the HTML in the shortcode content so that the output is well formatted and free of syntax issues.

    There are lots of “double quotes” and special characters in your HTML. You should spend some time analyzing and fixing them. Check if you can find any tools online to highlight the syntax and errors.

    W.R.T shortcoder there are no restrictions. What you set is what you get. The plugin never manipulates user code.

    Regarding default values, if no value is passed to the parameter for that specific shortcode call then the default value will be taken. There is no concept of inherited default values.

    Thanks,
    Aakash

    Dennis Bareis
    Participant

    Hi Aakash,

    So you tried the code earlier, have you now tried it in a images description and it also worked?

    You have my full example (“IMAGE SOURCE: %%text%%“) if there is a syntax error in that text then please let me know what it is… It doesn’t even contain HTML or have any characters that need escaping and it fails.

    Both your info/FAQ and WordPress’s says “where supported” many times, but I haven’t seen any place that documents where those supported places are… I’m guessing, since it sort of works (rather than show the shortcode text as I enter it) that it is supported for image descriptions but perhaps needs to be processed differently.

    About the parameters, it’s a pity that I have to hard code the default value in multiple places then, it sort of forces me to do the opposite of what Shortcoder’s aim is (everything in a single place).

    Please insert the shortcode with single quotes.

    [sc name='attribution_for_all_plant_photos_needing_it' text='Geekstreet, CC BY-SA 4.0 https://creativecommons.org/licenses/by-sa/4.0, via Wikimedia Commons'][/sc]

    Dennis Bareis
    Participant

    Thanks for that. I actually tried leaving double quotes where you changed then and changed all the quotes in the html as I know that is supported. That appaers to have worked also.

    I haven’t seen any mention in your doco that single quotes were supported.

    I will play with this some more but for now I have asked a new question about invoking one shortcut from another which I already know works, where it doesn’t seem to work is if the name of the 2nd shortcut uses passed parameters!

    Shortcodes created with Shortcoder are like any other shortcode you use.

    I can add it to the Shortcoder’s doc too.

    More info on dos and don’ts in WordPress’s docs below.
    https://codex.wordpress.org/Shortcode_API#HTML

    Thanks,
    Aakash

    Dennis Bareis
    Participant

    I will try again later but for now using single quotes works for a gallery image’s TITLE attribute but not for an image’s DESCRIPTION. I will try a WP shortcode and see if I can reproduce this issue and then report as a bug/feature.

    Dennis Bareis
    Participant

    I don’t quite understand what it is trying to say yet, but it sounds like this may be what is happening on DESCRIPTION but not TITLE: WordPress attempts to insert curly quotes between the [name] and [/name] tags

    Dennis Bareis
    Participant

    As a sanity check I tried the following without shortcodes:

    sorry WP hangs with the sample

    That worked, but both the single and double quotes were modified as I’ve mentioned before. Do WP (or your) shortcodes handle other quote characters such as “`” (backtick), I’m not sure who parses the parameters etc, but I suspect that that would work as they don’t get modified by WP.

    Failing that, is there any hooks I should try to work around this?

    Hi Dennis,

    Shortcoder parameters accept double and single quotes only.

    w.r.t the latest query, I did not understand that or the context. When you say it does not work in description, what does it mean? Is it related to shortcoder? Any sample code/example/screenshots on that?

    Thanks,
    Aakash

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.

Subscribe for updates

Get updates on the WordPress plugins, tips and tricks to enhance your WordPress experience. No spam. View newsletter