• Hello,
    thanks very much for you great plugin.
    I like and use it a lot.

    But now I have a problem and hope you can help me.
    I like to create a link with your plugin. This link should consist of 2 custom fields:
    Customfield 1 is the needed url, custom field 2 is the tracking ID which only depends from shop to shop. In the Shortcode I like to use it like this:
    <a href="$$custom_field:url-shop$$$$custom_field:shop-name$$" target="_blank" rel="nofollow noopener noreferrer" title="%%title:title%%">
    But if I do this, then the second custom_field is not working (it is not added in the link)
    If I try to use a spaces between the custom-fields, than both fields are working but my link isn’t working any more:-(
    <a href="$$custom_field:url-shop$$ $$custom_field:shop-name$$" target="_blank" rel="nofollow noopener noreferrer" title="%%title:title%%">

    Can you please help me here?
    Best regards
    Oli

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author vaakash

    (@vaakash)

    Hi @oli89,

    Thanks for using shortcoder.

    Regarding the issue, it looks like there is an issue with the parser to identify custom fields.

    I’ll work on this issue and let you know on a temp workaround.

    Thanks,
    Aakash

    Thread Starter oli89

    (@oli89)

    Hi @vaakash,
    thanks very much for your fast answer and your help.

    I will be really lucky to hear from you:-)

    best regards
    Oli

    Plugin Author vaakash

    (@vaakash)

    Hi @oli89,

    Please go to Plugin editor and select shortcoder –> shortcoder.php

    Replace line number 277

    preg_match_all('/\$\$[^\s]+\$\$/', $content, $matches );

    with this

    preg_match_all('/\$\$[^\s^$]+\$\$/', $content, $matches );

    and save the changes. Now it should work.
    Please let me know how it goes.

    Thanks,
    Aakash

    Thread Starter oli89

    (@oli89)

    Hi @vaakash,
    thanks very much for the fast help.
    I have try your code and it works, thanks very much.

    Sorry but I have found 2 more things, which I am not sure if there working right.
    1: I have try to build the link on a better way now. For this I use the “attached” mode of on the ACF Single text box, so I can copy the link in the text box and the tracking-id will added automatically. But in the shortcoder I get only the things from the textbox without the added tracking-id. Is there maybe also a misstake?

    2: I have in the ACF now one field to select the shop, depending to the selected shop there is a rule how show only the textbox with the correct tracking-id of the selected shop on my page-site. In case that the shortcoder have to work with the selected shop I add now all the ACF (one after the other) in my link. My hopping was, that the shortcoder only use the ACF, which are currently available (in case of the rule) on my page, but the plugin work also with the not available ACF and add them to the code. Is this the way it should work, or can you maybe also take a look to this function?

    I will be really happy to hear from you again
    Best regards
    Oli

    Thread Starter oli89

    (@oli89)

    Hi @vaakash,
    how are you? hope fine!

    Do you received my message?

    Best regards
    Oli

    Plugin Author vaakash

    (@vaakash)

    Hi @oli89,

    Sorry I missed your reply. Regarding your query with custom fields, I did not completely understand your setup as I have not worked extensively with ACF.

    But one thing I can tell is that shortcoder does not understand how ACF works or how ACF saves it’s data.

    To explain how this works, WordPress by default provides “custom fields” which you can see below the editor. Shortcoder will simply take that value for the field name you have provided.

    https://i.snipboard.io/7vo83N.jpg

    ACF just provides a rich way to work with custom fields.

    Shortcoder does not use any of ACF’s API to understand it.
    It will simply get the value for the custom field name you have provided.

    Please note that, this feature is just a basic and quick way to change shortcode content based on custom field value.

    If shortcoder is not functioning as mentioned above or if you would like to share a generic idea to enhance this feature please let me know.

    Thanks,
    Aakash

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Shortcode Link with two custom_field’ is closed to new replies.