0

For some reason, I am battling to make sense of everything. This is my code on paste bin: http://pastebin.com/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.

  • And you are sure that the data is stored in the options table? – Robbert Jan 12 '17 at 14:54
  • @Robbert – yes I am sure. This is what's stored 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:"info@emailaddress.com";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 Jan 12 '17 at 15:03
  • This is a serialized option. You need to unserialize it to get your option. – Robbert Jan 12 '17 at 15:12
0

Because 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];
}
?>
| improve this answer | |
0

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.

| improve this answer | |

Your Answer

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