CCCPaste

Category Selector for Single Post || Example Change Logo for Spe

/* Category Selector for Single Post || Example Change Logo for Spesific Single Post by Category Slug */
if ( is_single() && is_singular() ) {
	$post          = get_post();
	$post_cat      = get_the_category( $post->ID );
	$primary_cat   = jnews_get_primary_category( $post->ID );
	$primary_cat   = get_category( $primary_cat );
	$post_cat_slug = array();

	array_push( $post_cat, $primary_cat );

	/* Get Category Slug */
	foreach ( $post_cat as $cat ) {
		array_push( $post_cat_slug, $cat->slug );
	}

	if ( in_array( 'mobile', $post_cat_slug ) ) { /*
		`mobile` is slug category you want to change logo for spesific single post */
		/* Logo URL Link  */
		$logo             = '/wp-content/uploads/2021/11/90-Radio-logo.png';
		$logo_retina      = '/wp-content/uploads/2021/11/[email protected]';
		$alt              = '/wp-content/uploads/2021/11/90-Radio-logo.png';
		$logo_dark        = '/wp-content/uploads/2021/11/90-Radio-logo-dark.png';
		$logo_retina_dark = '/wp-content/uploads/2021/11/[email protected]';
	}
}