update_option('wpupg_custom_template_' . intval($id), $template['template']); } $this->update_mapping($mapping); } } public function add_template($name, $template) { $mapping = $this->get_mapping(); $template_id = max(array_keys($mapping)) + 1; if ($template_id < 100) { $template_id = 100; } $mapping[$template_id] = $name; $this->update_mapping($mapping); update_option('wpupg_custom_template_' . $template_id, $template); return $template_id; } public function update_template($id, $template) { update_option('wpupg_custom_template_' . $id, $template); } public function delete_template($id) { $mapping = $this->get_mapping(); unset($mapping[$id]); $this->update_mapping($mapping); delete_option('wpupg_custom_template_' . $id); } } WPUltimatePostGrid::loaded_addon('custom-templates', new WPUPG_Custom_Templates());