<?php
/**
 * @var $hidden_description
 */

if ( ! empty( $term->description ) && isset( $term->term_id ) ) {
	// Job
	if ( $term->taxonomy == 'job_cat' && wpj_get_option( 'wpjobster_display_job_category_description' ) != 'no' ) {
		if (
			(
				$term->parent == 0
				&& (
					wpj_get_option( 'wpjobster_display_job_category_description' ) == 'yes'
					|| wpj_get_option( 'wpjobster_display_job_category_description' ) == 'only_for_categories'
				)
			)
			||
			(
				$term->parent > 0
				&& (
					wpj_get_option( 'wpjobster_display_job_category_description' ) == 'yes'
					|| wpj_get_option( 'wpjobster_display_job_category_description' ) == 'only_for_subcategories'
				)
			)
		) {
			echo wpautop( wptexturize( $term->description ) );

			$hidden_description = false;

		}

	}

	// Request
	if ( $term->taxonomy == 'request_cat' && wpj_get_option( 'wpjobster_display_request_category_description' ) != 'no' ) {
		if (
			(
				$term->parent == 0
				&& (
					wpj_get_option( 'wpjobster_display_request_category_description' ) == 'yes'
					|| wpj_get_option( 'wpjobster_display_request_category_description' ) == 'only_for_categories'
				)
			)
			||
			(
				$term->parent > 0
				&& (
					wpj_get_option( 'wpjobster_display_request_category_description' ) == 'yes'
					|| wpj_get_option( 'wpjobster_display_request_category_description' ) == 'only_for_subcategories'
				)
			)
		) {
			echo wpautop( wptexturize( $term->description ) );

			$hidden_description = false;

		}

	}

	// Other
	if ( $term->taxonomy != 'job_cat' && $term->taxonomy != 'request_cat' ) {
		echo wpautop( wptexturize( $term->description ) );

		$hidden_description = false;

	}

}

if ( $hidden_description ) echo '<style>.category-description-row-wrapper{display:none;}</style>'; // for page builder