For some reason, I am battling to make sense of everything. This is my code on paste bin:
I want to be able to retrieve the options that are saved in the fields. This does not return anything:
<a href="<?php echo get_option('contact_details_vimeo_render'); ?>" target="_blank">
<i class="fa fa-vimeo" aria-hidden="true"></i>
</a>
I basically want to be able to retrieve the stored data as desired.
For some reason, I am battling to make sense of everything. This is my code on paste bin: http://pastebin/dJxGS6x6
I want to be able to retrieve the options that are saved in the fields. This does not return anything:
<a href="<?php echo get_option('contact_details_vimeo_render'); ?>" target="_blank">
<i class="fa fa-vimeo" aria-hidden="true"></i>
</a>
I basically want to be able to retrieve the stored data as desired.
Share Improve this question edited Oct 20, 2019 at 8:10 fuxia♦ 107k39 gold badges255 silver badges459 bronze badges asked Jan 12, 2017 at 14:49 user23355user23355 3 |2 Answers
Reset to default 0Because your options are stored in one overarching serialized option, you have to make a function like below to retrieve the right option.
<?php
function get_contact_details_setting( $option ) {
$contact_details_settings = unserialize( get_option( 'contact_details_settings' ) );
return $contact_details_settings[$option];
}
?>
Clearly I wasn't thinking :-(
Since all my options/settings are wrapped in a function that's how I need to retrieve them.... Do you get it? Using the function (I mean... hello!).
Rough code:
$x = contact_details_telephone_render();
echo $x;
That will display the telephone number.
a:6:{s:25:"contact_details_telephone";s:14:"+27 21 999 9999";s:19:"contact_details_fax";s:14:"+27 21 999 9999";s:21:"contact_details_email";s:16:"[email protected]";s:28:"contact_details_facebook_url";s:0:"";s:23:"contact_details_twitter";s:0:"";s:32:"contact_details_textarea_field_5";s:80:"Adderess Line1, Address Line2, 8001, Cape Town, South Africa ";}
– user23355 Commented Jan 12, 2017 at 15:03