I'm running multisite with each subsite using the same custom theme. I'm using NHP Options for logo upload and contact page info changes in that theme.
I'd like to add a site list page to the main site (which is using a different theme) and have each subsites logo be displayed beside its name in the list.
Getting the site list was fine - no problems there, but for the life of me I can't figure out how to get the logos to show.
The data is stored in a serialized array in each sites options table - with the option_name of 'nhp_opts'.
The data looks like this :
a:5:{s:8:"last_tab";s:1:"0";i:19;s:59:"http://_PATH_TO_LOGO.png";i:20;
s:34:"Test Street,Testing,Co. Test";i:21;s:16:"(000) 123 456789";s:10:"multi_text";
a:4:{i:0;s:21:"Mon - Fri 9.30 - 6.00";i:1;s:18:"Sat - 10.00 - 6.00";
i:2;s:18:"Sun - 12.00 - 5.00";i:3;s:22:"Bank Holidays - Closed";}}
and the code I cobbled together is this:
<?php global $wpdb;
$logos = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->options WHERE option_name = nhp_opts "));
foreach($logos as $logo){
$thedata = $logos;
$thedata = unserialize($thedata);
echo $thedata;
}?>
All I get is Array() - repeated a bunch of times.
I'm not very familiar with working directly with the database - so I'm not overly surprised this didn't work!
I've spent a few days now puzzling this one out - any help at all would be greatly appreciated! Thanks!
echo get_option('nhp_opts');
?