<?php
/**
 * Helper | Classes
 *
 * @package Dotspice
 * @version 1.3.0
 */


/**
 * Content Class
 *
 * @return string
 */
function dotspice_content_class() {
	$content_class = array( 'content' );

	// Frontpage
	if ( is_front_page() && is_page() ) {
		$content_class[] = 'front-content';
	}

	// Error 404
	else if ( is_404() ) {
		$content_class[] = 'error-404-content';
	}

	// Archive
	else if ( is_post_type_archive() ) {
		$content_class[] = 'archive-' . get_query_var( 'post_type' ) . '-content';
	}

	// Taxonomy
	else if ( is_tax() ) {
		$content_class[] = get_queried_object()->taxonomy . '-content';
	}

	// Single
	else if ( is_singular() ) {
		global $post;

		if ( isset( $post ) ) {
			$content_class[] = $post->post_type . '-' . $post->post_name;

			if ( class_exists( 'woocommerce' ) && ( is_woocommerce() || is_cart() || is_checkout() || is_account_page() ) ) {
				$content_class[] = 'woo-content';
			}
			else {
				$content_class[] = $post->post_type . '-content';
			}
		}
	}

	else {
		$content_class[] = 'archive-content';
	}

	echo esc_attr( implode( ' ', $content_class ) );
}