0

i want to have dynamic shortcode to CF7

when i create new Contact form the id is different from develop env to production

i decide to put my shortcodes in my plugin settings.

and use them as option

            <?php
            echo do_shortcode(get_option("email_ShortCode_text"));
            ?>

the more important code is this code that used in setting:

        <p>Enter your email_shortcode
        </p> <input type="text" name="email_ShortCode_text" value="<?php echo get_option('email_ShortCode_text'); ?>" />

        <hr />

but when user put his shortcode in my plugin setting then save it worked

but second time when shortcodes raed from database missed some characters

so when save all those settings missed

please help me

how can i convert setting to normal string when read from wordpress?

thank you

  • 1
    The more important code here is the code for adding and saving the setting. – Jacob Peattie Oct 14 at 8:47
  • thank you ... i put it here for you. – saber tabatabaee yazdi Oct 14 at 9:22
0

just need to use text area instead of input in your settings page:

        <p>Enter your email shortcode
        </p> <textarea type="text" name="email_ShortCode_text" > <?php echo stripslashes(get_option('email_ShortCode_text')); ?>" </textarea>

        <hr />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.