Tagged: array
- This topic has 3 replies, 2 voices, and was last updated 5 years, 7 months ago by
Steve.
Viewing 3 reply threads
-
AuthorPosts
-
-
July 8, 2016 at 6:45 am #6918
semwangajoshuaMemberI’m trying to retrieve a field value from a settings page but I haven’t been successful yet. This is what I’m doing:
<?php $theme_options = get_option('lawyeah_theme_settings'); $stmp_postn1_vsb = $theme_options['stmp_postn1_vsb']; echo $stmp_postn1_vsb; ?>NB: stmp_postn1_vsb is the field name of the field whose value I want to retrieve.
I’ve also tried to use
get_option($stmp)postn1_vsb, $default = show);but in vain.
I’ve also tried to use this as per the documentation,<?php $theme_options = get_option('my_theme_settings'); $stmp_postn1_vsb = $theme_options['$stmp_postn1_vsb']; echo 'Testing this field' . $stmp_postn1_vsb; ?>One thing that has been so noticeable about using the above code is that it throws an error that says,
<b>Notice</b>: Array to string conversion in <b>C:\xampp\htdocs\lawyeah\wp-content\themes\Joshua\footer.php</b> on line <b>111</b> This is a test fieldArray -
July 8, 2016 at 4:41 pm #6923
-
July 11, 2016 at 11:00 am #6930
semwangajoshuaMemberThanks a lot Steve. I followed your advice and it surely did work. I did it like this:
<?php $theme_options = get_option('libra_settings'); $stmp_area_vsb = $theme_options["stmp_area_vsb"]; foreach ($stmp_area_vsb as $value) { echo "$value"; }?> -
July 11, 2016 at 11:02 am #6931
SteveKeymasterPerfect!
Since Piklist does everything the WordPress and PHP way, that code will work on any array. Not just Piklist.
Closing ticket.
-
-
AuthorPosts
Viewing 3 reply threads
- The topic ‘How to get data from settings page to show on frontend’ is closed to new replies.