CCCPaste

Change Logo for Header, Mobile, and Sticky Logo || Example for S

/** Change Header Logo || Example for Spesific Category */
function jnews_generate_header_logo( $echo = true ) {
	if ( get_theme_mod( 'jnews_header_logo_type', 'image' ) === 'image' ) {
		$logo        = get_theme_mod( 'jnews_header_logo', get_parent_theme_file_uri( 'assets/img/logo.png' ) );
		$logo_retina = get_theme_mod( 'jnews_header_logo_retina', get_parent_theme_file_uri( 'assets/img/[email protected]' ) );
		$alt         = get_theme_mod( 'jnews_header_logo_alt', get_bloginfo( 'name' ) );

		/* Dark logo */
		$logo_dark        = get_theme_mod( 'jnews_header_logo_darkmode', get_parent_theme_file_uri( 'assets/img/logo_darkmode.png' ) );
		$logo_retina_dark = get_theme_mod( 'jnews_header_logo_retina_darkmode', get_parent_theme_file_uri( 'assets/img/[email protected]' ) );

		/* START Custom Change */
		$term          = get_queried_object(); /* Get Current Category Data */
		$list_category = array( '90radio', 'another-example-category-slug', 'lifestyle' ); /* List Slug of Category */
		if ( is_category() && in_array( $term->slug, $list_category ) ) { /* If is Category Page and Current Category Slug in List Category */
			/* Link Logo URL */
			$logo             = 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Service_mark.svg/1280px-Service_mark.svg.png';
			$logo_retina      = 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Service_mark.svg/1280px-Service_mark.svg.png';
			$alt              = 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Service_mark.svg/1280px-Service_mark.svg.png';
			$logo_dark        = 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Service_mark.svg/1280px-Service_mark.svg.png';
			$logo_retina_dark = 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Service_mark.svg/1280px-Service_mark.svg.png';
		}
		/* END Custom Change */

		return JNews\Image\Image::generate_image_retina( $logo, $logo_retina, $alt, $echo, $logo_dark, $logo_retina_dark );
	} else {
		$logo_text = get_theme_mod( 'jnews_header_logo_text', 'Logo' );

		return jnews_generate_logo_text( $logo_text, $echo );
	}
}

/** Change Mobile Logo || Example for Spesific Category */
function jnews_generate_mobile_logo( $echo = true ) {
	if ( get_theme_mod( 'jnews_mobile_logo_type', 'image' ) === 'image' ) {
		$logo        = get_theme_mod( 'jnews_mobile_logo', get_parent_theme_file_uri( 'assets/img/logo_mobile.png' ) );
		$logo_retina = get_theme_mod( 'jnews_mobile_logo_retina', get_parent_theme_file_uri( 'assets/img/[email protected]' ) );
		$alt         = get_theme_mod( 'jnews_mobile_logo_alt', get_bloginfo( 'name' ) );

		/*Dark logo*/
		$logo_dark        = get_theme_mod( 'jnews_mobile_logo_darkmode', get_parent_theme_file_uri( 'assets/img/logo_darkmode.png' ) );
		$logo_retina_dark = get_theme_mod( 'jnews_mobile_logo_retina_darkmode', get_parent_theme_file_uri( 'assets/img/[email protected]' ) );

		/* START Custom Change */
		$term          = get_queried_object(); /* Get Current Category Data */
		$list_category = array( '90radio', 'another-example-category-slug', 'lifestyle' ); /* List Slug of Category */
		if ( is_category() && in_array( $term->slug, $list_category ) ) { /* If is Category Page and Current Category Slug in List Category */
			/* Link Logo URL */
			$logo             = 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Service_mark.svg/1280px-Service_mark.svg.png';
			$logo_retina      = 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Service_mark.svg/1280px-Service_mark.svg.png';
			$alt              = 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Service_mark.svg/1280px-Service_mark.svg.png';
			$logo_dark        = 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Service_mark.svg/1280px-Service_mark.svg.png';
			$logo_retina_dark = 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Service_mark.svg/1280px-Service_mark.svg.png';
		}
		/* END Custom Change */

		return JNews\Image\Image::generate_image_retina( $logo, $logo_retina, $alt, $echo, $logo_dark, $logo_retina_dark );
	} else {
		$logo_text = get_theme_mod( 'jnews_mobile_logo_text', 'Logo' );

		return jnews_generate_logo_text( $logo_text, $echo );
	}
}

/** Change Sticky Logo || Example for Spesific Category */
function jnews_generate_sticky_logo( $echo = true ) {
	if ( get_theme_mod( 'jnews_sticky_logo_type', 'image' ) === 'image' ) {
		$logo        = get_theme_mod( 'jnews_sticky_menu_logo', get_parent_theme_file_uri( 'assets/img/sticky_logo.png' ) );
		$logo_retina = get_theme_mod( 'jnews_sticky_menu_logo_retina', get_parent_theme_file_uri( 'assets/img/[email protected]' ) );
		$alt         = get_theme_mod( 'jnews_sticky_menu_alt', get_bloginfo( 'name' ) );

		/*Dark logo*/
		$logo_dark        = get_theme_mod( 'jnews_sticky_menu_logo_darkmode', get_parent_theme_file_uri( 'assets/img/logo_darkmode.png' ) );
		$logo_retina_dark = get_theme_mod( 'jnews_sticky_menu_logo_retina_darkmode', get_parent_theme_file_uri( 'assets/img/[email protected]' ) );

		/* START Custom Change */
		$term          = get_queried_object(); /* Get Current Category Data */
		$list_category = array( '90radio', 'another-example-category-slug', 'lifestyle' ); /* List Slug of Category */
		if ( is_category() && in_array( $term->slug, $list_category ) ) { /* If is Category Page and Current Category Slug in List Category */
			/* Link Logo URL */
			$logo             = 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Service_mark.svg/1280px-Service_mark.svg.png';
			$logo_retina      = 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Service_mark.svg/1280px-Service_mark.svg.png';
			$alt              = 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Service_mark.svg/1280px-Service_mark.svg.png';
			$logo_dark        = 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Service_mark.svg/1280px-Service_mark.svg.png';
			$logo_retina_dark = 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Service_mark.svg/1280px-Service_mark.svg.png';
		}
		/* END Custom Change */

		return JNews\Image\Image::generate_image_retina( $logo, $logo_retina, $alt, $echo, $logo_dark, $logo_retina_dark );
	} else {
		$logo_text = get_theme_mod( 'jnews_sticky_logo_text', 'Logo' );

		return jnews_generate_logo_text( $logo_text, $echo );
	}
}