function op_template_include($template, $use_template = true) { /* * Assuring that we don't run this method twice (once on the template_include and once on the index_template hook) */ static $passed; if (isset($passed) && true === $passed && !empty($template)) { return $template; } $passed = true; if (op_get_option('blog_enabled') != 'Y' || op_get_option('installed') != 'Y') { global $post; if (!empty($post) && 'page' != $post->post_type) { return OP_DIR . 'index.php'; } } if ($use_template) { if ($id = get_queried_object_id()) { $status = get_post_status($id); if ($status == 'publish' || (current_user_can('edit_posts') || current_user_can('edit_pages'))) { if (get_post_meta($id, '_' . OP_SN . '_pagebuilder', true) == 'Y') { op_init_page($id); if (op_page_option('launch_funnel', 'enabled') == 'Y' && ($launch_info = op_page_option('launch_suite_info'))) { require_once OP_FUNC . 'launch.php'; } $theme = op_page_option('theme'); $file = OP_PAGES . $theme['type'] . '/' . $theme['dir'] . '/template.php'; if (file_exists($file)) { return apply_filters('op_check_page_availability', $file); } } else { op_init_theme(); if ($tpl = get_post_meta($id, '_op_page_template', true)) { if (file_exists(OP_THEME_DIR . $tpl . '.php')) { return OP_THEME_DIR . $tpl . '.php'; } } } } else { op_init_theme(); } } else { op_init_theme(); } } $checks = array('is_404' => '404', 'is_search' => 'search', 'is_front_page' => 'front_page', 'is_home' => 'home', 'is_single' => 'single', 'is_page' => 'page', 'is_category' => 'category', 'is_tag' => 'tag', 'is_author' => 'author', 'is_archive' => 'archive', 'is_paged' => 'paged'); $checks = apply_filters('op_template_include_checks', $checks); foreach ($checks as $check => $type) { if ($check()) { $files = apply_filters('op_template_include-' . $type, array($type)); foreach ($files as $file) { if (file_exists(OP_THEME_DIR . $file . '.php')) { return OP_THEME_DIR . $file . '.php'; } } } } if (defined('OP_THEME_DIR')) { return OP_THEME_DIR . 'index.php'; } else { return OP_DIR . 'index.php'; } }
function op_template_include($template, $use_template = true) { if ($use_template) { if ($id = get_queried_object_id()) { $status = get_post_status($id); if ($status == 'publish' || (current_user_can('edit_posts') || current_user_can('edit_pages'))) { if (get_post_meta($id, '_' . OP_SN . '_pagebuilder', true) == 'Y') { op_init_page($id); if (op_page_option('launch_funnel', 'enabled') == 'Y' && ($launch_info = op_page_option('launch_suite_info'))) { require_once OP_FUNC . 'launch.php'; } $theme = op_page_option('theme'); $file = OP_PAGES . $theme['type'] . '/' . $theme['dir'] . '/template.php'; if (file_exists($file)) { return apply_filters('op_check_page_availability', $file); } } } } } return $template; }
function op_template_include($template, $use_template = true) { /*if(op_get_option('blog_enabled') != 'Y' || op_get_option('installed') != 'Y'){ global $post; if (!empty($post) && 'page' != $post->post_type) { return OP_DIR.'index.php'; } }*/ if ($use_template) { if ($id = get_queried_object_id()) { $status = get_post_status($id); if ($status == 'publish' || (current_user_can('edit_posts') || current_user_can('edit_pages'))) { if (get_post_meta($id, '_' . OP_SN . '_pagebuilder', true) == 'Y') { op_init_page($id); if (op_page_option('launch_funnel', 'enabled') == 'Y' && ($launch_info = op_page_option('launch_suite_info'))) { require_once OP_FUNC . 'launch.php'; } $theme = op_page_option('theme'); $file = OP_PAGES . $theme['type'] . '/' . $theme['dir'] . '/template.php'; if (file_exists($file)) { return $file; } } } } } return $template; }