• Resolved Petr

    (@csclubtauranga)


    I’m just dealing with an issue I can’t fathom. The solution for obrtaining an email address from shortcode attributes worked perfectly for a few days. Now something has changed (probably) and I can’t get the value through.

    I have used the shortcode inside a custom post and was getting the email from the post.
    Now when I try I get blank input field on the front end. Perhaps someone can see, what’s going wrong.

    $artist_email =  gdlr_get_portfolio_info(array('artist-email'), $gdlr_post_option, false);
    
    echo do_shortcode( '[contact-form-7 id="16" title="Artist Booking Form - do not delete" artist-email=" '. $artist_email .' "]' );

    When I simply echo the variable $artist_email I can see it no problem. I can even see the first character if I do:
    echo do_shortcode( '[contact-form-7 id="16" title="Artist Booking Form - do not delete" artist-email=" '. $artist_email[0] .' "]' );

    But not the complete address. What gives?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Petr

    (@csclubtauranga)

    So far I have identified the following:

    • If I use a hard-coded email address in the shortcode, then the default value is shown in the form
    • If I deactivate the plugin, whilst using a variable for the value, I can see the shortcode on the front end in plain text with the actual artist’s email address in place.
    • So it is only case when it doesn’t work is…. well the way it should, i.e. pulling the value of a variable to the front end and populating the input field with it.

    Any help would be greatly appreciated. Thanks.

    • This reply was modified 7 years, 4 months ago by Petr.
    Thread Starter Petr

    (@csclubtauranga)

    The issue seems to have been caused by a string variable being passed in. I found that was getting padded with by 25 chars. This in turn probably exceeded the space allowed for the default value.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Attribute Shortcode suddenly not working’ is closed to new replies.