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
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
Share Improve this question edited Oct 14, 2019 at 9:24 saber tabatabaee yazdi asked Oct 14, 2019 at 8:36 saber tabatabaee yazdisaber tabatabaee yazdi 1931 gold badge5 silver badges13 bronze badges 2- 1 The more important code here is the code for adding and saving the setting. – Jacob Peattie Commented Oct 14, 2019 at 8:47
- thank you ... i put it here for you. – saber tabatabaee yazdi Commented Oct 14, 2019 at 9:22
1 Answer
Reset to default 0just 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 />