function type() { global $pl_404; if (is_404() && $pl_404) { $type = '404_page'; } elseif (is_post_type_archive()) { $type = pl_get_post_type_plural(); } elseif (is_tag()) { $type = 'tag'; } elseif (is_search()) { $type = 'search'; } elseif (is_category()) { $type = 'category'; } elseif (is_author()) { $type = 'author'; } elseif (is_archive()) { $type = 'archive'; } elseif (is_home()) { $type = 'blog'; } elseif (pl_is_cpt()) { $type = get_post_type(); } elseif (is_page()) { $type = 'page'; } elseif (is_single()) { $type = 'post'; } else { $type = 'other'; } return $type; }
/** * Page Type Breaker * * Returns template type based on WordPress conditionals * * @return mixed|void */ public function page_type_breaker() { global $post; global $pl_integration; if (pl_is_integration()) { $type = pl_get_integration(); } elseif (is_404()) { $type = '404_page'; } elseif (pl_is_cpt('archive')) { $type = get_post_type_plural(); } elseif (pl_is_cpt()) { $type = get_post_type(); } elseif (is_tag() && VPRO) { $type = 'tag'; } elseif (is_search() && VPRO) { $type = 'search'; } elseif (is_category() && VPRO) { $type = 'category'; } elseif (is_author() && VPRO) { $type = 'author'; } elseif (is_archive() && VPRO) { $type = 'archive'; } elseif (is_home() || !VPRO && is_pagelines_special()) { $type = 'posts'; } elseif (is_page_template()) { /** Strip the page. and .php from page.[template-name].php */ $page_filename = str_replace('.php', '', get_post_meta($post->ID, '_wp_page_template', true)); $template_name = str_replace('page.', '', $page_filename); $type = $template_name; } elseif (is_single()) { $type = 'single'; } else { $type = 'default'; } return apply_filters('pagelines_page_type', $type, $post); }