source/php/Helper/Wp.php
public static function getArchiveSlug()
    {
        global $wp_query;

        if ($wp_query && !is_tax() && (is_post_type_archive() || is_archive() || is_home() || is_search() || is_404())) {
            $postType = get_post_type();

            if (isset($wp_query->query_vars['post_type']) && !empty($wp_query->query_vars['post_type'])) {
                $postType = $wp_query->query_vars['post_type'];
            }

            if (is_home()) {
                $archiveSlug = 'archive-post';
            } elseif (is_post_type_archive() && is_search()) {
                $archiveSlug = 'archive-' . get_post_type_object($postType)->name;
            } elseif (is_search()) {
                $archiveSlug = 'search';
            } elseif (is_404()) {
                $archiveSlug = 'e404';
            } elseif (is_author()) {
                $archiveSlug = 'author';
            } else {
                $archiveSlug = 'archive-' . get_post_type_object($postType)->name;
            }

            return $archiveSlug;
        }

        return false;
    }
public static function getArchiveSlug()
    {
        global $wp_query;

        if ($wp_query && !is_tax() && (is_post_type_archive() || is_archive() || is_home() || is_search() || is_404())) {
            $postType = get_post_type();

            if (isset($wp_query->query_vars['post_type']) && !empty($wp_query->query_vars['post_type'])) {
                $postType = $wp_query->query_vars['post_type'];
            }

            if (is_home()) {
                $archiveSlug = 'archive-post';
            } elseif (is_post_type_archive() && is_search()) {
                $archiveSlug = 'archive-' . get_post_type_object($postType)->name;
            } elseif (is_search()) {
                $archiveSlug = 'search';
            } elseif (is_404()) {
                $archiveSlug = 'e404';
            } elseif (is_author()) {
                $archiveSlug = 'author';
            } else {
                $archiveSlug = 'archive-' . get_post_type_object($postType)->name;
            }

            return $archiveSlug;
        }

        return false;
    }
public static function getArchiveSlug ( ) { global $ wp_query ; if ( $ wp_query && ! is_tax ( ) && ( is_post_type_archive ( ) || is_archive ( ) || is_home ( ) || is_search ( ) || is_404 ( ) ) ) { $ postType = get_post_type ( ) ; if ( isset ( $ wp_query -> query_vars [ 'post_type' ] ) && ! empty ( $ wp_query -> query_vars [ 'post_type' ] ) ) { $ postType = $ wp_query -> query_vars [ 'post_type' ] ; } if ( is_home ( ) ) { $ archiveSlug = 'archive-post' ; } elseif ( is_post_type_archive ( ) && is_search ( ) ) { $ archiveSlug = 'archive-' . get_post_type_object ( $ postType ) -> name ; } elseif ( is_search ( ) ) { $ archiveSlug = 'search' ; } elseif ( is_404 ( ) ) { $ archiveSlug = 'e404' ; } elseif ( is_author ( ) ) { $ archiveSlug = 'author' ; } else { $ archiveSlug = 'archive-' . get_post_type_object ( $ postType ) -> name ; } return $ archiveSlug ; } return false ; }
Fetches current archive slug
@return mixed (string, boolean) False if not archive else archive slug
Fetches current archive slug