Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Change Logo for Spesific Category Page || 90Radio Category Page for Example */
- 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/logo@2x.png' ) );
- $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/logo_darkmode@2x.png' ) );
- /* 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 );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement