我正在使用wordpress“报纸主题”,我想更改某些页面上的标题徽标,而不更改其余部分使用的默认值。
我所做的是将logo.php从hostmonster文件管理器更改为:
<?php
/**
* Created by PhpStorm.
* User: ra
* Date: 4/22/14
* Time: 10:08 AM
*/
//read the logo + retina logo
$td_customLogo = td_util::get_option('tds_logo_upload');
$td_customLogoR = td_util::get_option('tds_logo_upload_r');
$td_logo_alt = td_util::get_option('tds_logo_alt');
$td_logo_title = td_util::get_option('tds_logo_title');
if (!empty($td_logo_title)) {
$td_logo_title = ' title="' . $td_logo_title . '"';
}
if (!empty($td_customLogoR)) { //if retina
if ($_GET['page_id'] == 110){
$td_customLogoR = 'http://www.arabi-group.com/wp-content/uploads/2016/05/araib-radio.jpg';
}elseif ($_GET['page_id'] == 179){
$td_customLogoR = 'http://www.arabi-group.com/wp-content/uploads/2016/05/13840505_10209929205285223_1180352314_o-1-e1469358582277.jpg';
}elseif ($_GET['page_id'] == 577){
$td_customLogoR = 'http://www.arabi-group.com/wp-content/uploads/2016/05/arabi-App.jpg';
}
?>
<a class="td-main-logo" href="<?php echo esc_url(home_url( '/' )); ?>">
<img class="td-retina-data" data-retina="<?php echo esc_attr($td_customLogoR) ?>" src="<?php echo $td_customLogo?>" alt="<?php echo $td_logo_alt ?>"<?php echo $td_logo_title ?>/>
</a>
<?php
} else { //not retina
if (!empty($td_customLogo)) {
if ($_GET['page_id'] == 110){
$td_customLogo = 'http://www.arabi-group.com/wp-content/uploads/2016/05/araib-radio.jpg';
}elseif ($_GET['page_id'] == 179){
$td_customLogo = 'http://www.arabi-group.com/wp-content/uploads/2016/05/13840505_10209929205285223_1180352314_o-1-e1469358582277.jpg';
}elseif ($_GET['page_id'] == 577){
$td_customLogo = 'http://www.arabi-group.com/wp-content/uploads/2016/05/arabi-App.jpg';
}
?>
<a class="td-main-logo" href="<?php echo esc_url(home_url( '/' )); ?>">
<img src="<?php echo $td_customLogo?>" alt="<?php echo $td_logo_alt ?>"<?php echo $td_logo_title ?>/>
</a>
<?php
}
}
标题中应包含不同徽标的网页包括: http://www.arabi-group.com/?page_id=110
http://www.arabi-group.com/?page_id=179
http://www.arabi-group.com/?page_id=577
什么阻止徽标发生变化?
答案 0 :(得分:0)
您只需按照我的来源进行编辑
if (is_page( 110 )){
$td_customLogoR = 'http://www.arabi-group.com/wp-content/uploads/2016/05/araib-radio.jpg';
}
一切都会奏效。
更新:您错误地在展示img src
属性
应该是
<a class="td-main-logo" href="<?php echo esc_url(home_url( '/' )); ?>">
<img class="td-retina-data" data-retina="<?php echo esc_attr($td_customLogoR); ?>" src="<?php echo $td_customLogoR; ?>" alt="<?php echo $td_logo_alt ?>"<?php echo $td_logo_title ?>/>
</a>