我正在尝试自定义Avada链接主站点徽标到自定义URL时,您在某些页面。我将logo.php复制到子主题中,并添加了以下内容:
<?php $standard_logo = Avada()->images->get_logo_image_srcset( 'logo', 'logo_retina' ); ?>
<!-- custom standard logos -->
<?php
//Binghamton
if (is_page( array (194, 376, 534, 329, 499, 489, 479, 476, 467)))
{
$standard_logo['srcset'] = '/wp-content/uploads/2018/06/broadway-binghamton-logo.png';
$standard_logo['url'] = $standard_logo['srcset'];
$retina_logo['srcset'] = '/wp-content/uploads/2018/06/broadway-binghamton-logo-retina.png';
$retina_logo['url'] = $standard_logo['srcset'];
}
//Erie
if (is_page( array (248, 382, 589, 926, 1542, 1537, 1514)))
{
$standard_logo['srcset'] = '/wp-content/uploads/2018/06/broadway-erie-logo.png';
$standard_logo['url'] = $standard_logo['srcset'];
$retina_logo['srcset'] = '/wp-content/uploads/2018/06/broadway-erie-logo.png';
$retina_logo['url'] = $standard_logo['srcset'];
}
?>
<!-- standard logo -->
<img src="<?php echo esc_url_raw( $standard_logo['url'] ); ?>" srcset="<?php echo esc_attr( $standard_logo['srcset'] ); ?>" width="<?php echo esc_attr( $standard_logo['width'] ); ?>" height="<?php echo esc_attr( $standard_logo['height'] ); ?>"<?php echo $standard_logo['style']; // WPCS: XSS ok. ?> alt="<?php echo esc_attr( $logo_alt_attribute ); ?>" retina_logo_url="<?php echo esc_url_raw( $standard_logo['is_retina'] ); ?>" class="fusion-standard-logo" />
<?php
if ( Avada()->settings->get( 'mobile_logo', 'url' ) && '' !== Avada()->settings->get( 'mobile_logo', 'url' ) ) {
$mobile_logo = Avada()->images->get_logo_image_srcset( 'mobile_logo', 'mobile_logo_retina' );
?>
<!-- custom mobile logos -->
<?php
//Binghamton
if (is_page( array (194, 376, 534, 329, 499, 489, 479, 476, 467)))
{
$mobile_logo['srcset'] = '/wp-content/uploads/2018/06/broadway-binghamton-logo.png';
$mobile_logo['url'] = $mobile_logo['srcset'];
}
//Erie
if (is_page( array (248, 382, 589, 926, 1542, 1537, 1514)))
{
$mobile_logo['srcset'] = '/wp-content/uploads/2018/06/broadway-erie-logo.png';
$mobile_logo['url'] = $mobile_logo['srcset'];
}
?>
<!-- mobile logo -->
<img src="<?php echo esc_url_raw( $mobile_logo['url'] ); ?>" srcset="<?php echo esc_attr( $mobile_logo['srcset'] ); ?>" width="<?php echo esc_attr( $mobile_logo['width'] ); ?>" height="<?php echo esc_attr( $mobile_logo['height'] ); ?>"<?php echo $mobile_logo['style']; // WPCS: XSS ok. ?> alt="<?php echo esc_attr( $logo_alt_attribute ); ?>" retina_logo_url="<?php echo esc_url_raw( $mobile_logo['is_retina'] ); ?>" class="fusion-mobile-logo" />
<?php } ?>
这将更改徽标以匹配正确的城市,但我需要城市徽标链接到城市页面,而不是主页。
http://nac.flywheelsites.com/broadway-in-binghamton/显示宾厄姆顿徽标,但当前链接回http://nac.flywheelsites.com/。
我试过了:
$standard_logo['/broadway-in-binghamton/'] = $standard_logo['srcset'];
但我不认为这是对的。类似的问题是进入header.php文件并找到您的徽标类,但此主题不会将其存储在那里。有没有办法在logo.php文件中直接插入自定义URL?
https://stackoverflow.com/questions/50766325
复制相似问题