'1,2', 'order' => 'ASC', 'fields' => 'ids', // Only get post IDs 'post_type' => 'page', 'numberposts' => -1, )); foreach($ids as $pid){ $data[$pid]['include'] = optPOST('include_pages_'.$pid); $data[$pid]['priority'] = optPOST('changeprior_pages_'.$pid); $data[$pid]['frequency'] = optPOST('changefreq_pages_'.$pid); } $data = json_encode($data); update_option('sitepad_sitemap', $data); $msg['success'] = "Sitemap settings have been saved successfully!"; }else{ $data = array(); $data = json_encode($data); update_option('sitepad_sitemap', $data); $msg['success'] = "Sitemap has been disabled successfully!"; } return $msg; } // Fetch sitemap data function sitepad_fetch_sitemap() { $sitemap_data = get_option('sitepad_sitemap'); $sitemap_data = json_decode($sitemap_data, true); // We do not have any sitemap data if(empty($sitemap_data)){ return false; } if($sitemap_data['enable_sitemap'] == 'on'){ return json_encode($sitemap_data); } return false; } if(isset($_POST['sitemap_save'])){ $msg = sitepad_save_sitemap(); if(!empty($msg['success'])){ echo '
'.__($msg['success']).'
'.__('Unable to save siteMap data for some reason').'