/** * If this post belongs to an archive page, it removes it from the option. * * @since 1.3.0 * @access private * * @param int $post_ID The deleted post ID. */ function jc_admin_delete_archive_page_ID($post_ID) { foreach (jc_template_pages() as $archive_ID => $title) { if ($jc_archive_page_ID = get_option("jc_archive_page_{$archive_ID}")) { if ($post_ID == $jc_archive_page_ID) { delete_option("jc_archive_page_{$archive_ID}"); } } } }
/** * Potentially swaps out the content if the current page is a "JC Page". * * @since 1.3.0 * @access private */ function jc_template_load_archive($template) { if ($template[0] == 'content' && is_page()) { $page_template_IDs = (array) get_option('jc_template_pages', array()); foreach ($page_template_IDs as $template_ID => $page_ID) { // Prevent empty page_ID $page_ID = !$page_ID ? -1 : $page_ID; if (is_page($page_ID)) { $template = jc_template_pages()[$template_ID]['template']; break; } } } return $template; }
"/> </td> </tr> </table> <?php break; case 'pages': settings_fields('jc-settings-pages'); $template_pages = (array) get_option('jc_template_pages', array()); ?> <h3>Pages</h3> <table class="form-table"> <?php foreach (jc_template_pages() as $template_ID => $template) { ?> <tr valign="top"> <th scope="row"> <label for="jc_template_pages"> <?php echo $template['label']; ?> </label> </th> <td> <?php $current_page_ID = false; if (isset($template_pages[$template_ID])) { $current_page_ID = $template_pages[$template_ID]; }