/** * GETS current post id * SETS : $is_active_editor , $is_active_pagebuilder , $current_post_id * * @access private */ public function get_post_id() { if (!empty(self::$post_id)) { return self::$post_id; } global $post; if (isset($_POST['post_id'])) { return self::$post_id = $_POST['post_id']; } elseif (is_singular() && !empty($post)) { return self::$post_id = $post->ID; } elseif (is_archive()) { // Check woocommerce archive if (znfw_is_woocommerce_active()) { // Woocommerce archive pages if (is_post_type_archive('product') || is_page(wc_get_page_id('shop'))) { return wc_get_page_id('shop'); } } else { return false; } } elseif (is_home()) { // This is the Blog archive page. We need to check if a custom page is used or not return get_option('page_for_posts'); } else { return false; } }
/** * GETS current post id * SETS : $is_active_editor , $is_active_pagebuilder , $current_post_id * * @access private */ public function get_post_id() { if (!empty(self::$post_id)) { return self::$post_id; } global $post; if (isset($_POST['post_id'])) { return self::$post_id = $_POST['post_id']; } elseif (is_singular() && !empty($post)) { return self::$post_id = $post->ID; } else { return false; } }