2016-12-05 69 views
-1

我有一個小問題。我正在開發一個WordPress的網站和主題「巴萊塔」。這個主題將一個文本添加到我想要刪除的頁腳中。通常我是通過編輯footer.php來完成的,但是這個主題不同。我要改變的functions.php原因有這樣一小段代碼片段:WordPress的:刪除functions.php網站信息

function barletta_footer_credits() { 
?> 
<div class="site-info"> 
<?php if (get_theme_mod('barletta_footer_text') == '') { ?> 
&copy; <?php echo date('Y'); ?> <?php bloginfo('name'); ?><?php esc_html_e('. All rights reserved.', 'barletta'); ?> 
<?php } else { echo esc_html(get_theme_mod('barletta_footer_text', 'barletta')); } ?> 
</div><!-- .site-info --> 

<?php 
$nofollow=""; 
if (!is_home()) { $nofollow="rel=\"nofollow\""; } 
printf(esc_html__('Theme by %1$s Powered by %2$s', 'barletta') , '<a href="http://moozthemes.com/" target="_blank" '.$nofollow.'>MOOZ Themes</a>', '<a href="http://wordpress.org/" target="_blank">WordPress</a>'); 
} 
add_action('barletta_footer', 'barletta_footer_credits'); 

我不是PHP所以這裏我的問題好:我怎麼編輯這個代碼的站點信息-DIV會仍然顯示,但不是打印文本(由...支持)?

回答

0

您應該刪除過去的,如果檢查:

function barletta_footer_credits() { 
?> 
    <div class="site-info"> 
     <?php if (get_theme_mod('barletta_footer_text') == '') { ?> 
      &copy; <?php echo date('Y'); ?> <?php bloginfo('name'); ?><?php esc_html_e('. All rights reserved.', 'barletta'); ?> 
     <?php } else { echo esc_html(get_theme_mod('barletta_footer_text', 'barletta')); } ?> 
    </div><!-- .site-info --> 
<?php 
} 
add_action('barletta_footer', 'barletta_footer_credits'); 
0

只需將代碼從

function barletta_footer_credits() { 
?> 
<div class="site-info"> 
<?php if (get_theme_mod('barletta_footer_text') == '') { ?> 
&copy; <?php echo date('Y'); ?> <?php bloginfo('name'); ?><?php esc_html_e('. All rights reserved.', 'barletta'); ?> 
<?php } else { echo esc_html(get_theme_mod('barletta_footer_text', 'barletta')); } ?> 
</div><!-- .site-info --> 

<?php 
$nofollow=""; 
if (!is_home()) { $nofollow="rel=\"nofollow\""; } 
printf(esc_html__('Theme by %1$s Powered by %2$s', 'barletta') , '<a href="http://moozthemes.com/" target="_blank" '.$nofollow.'>MOOZ Themes</a>', '<a href="http://wordpress.org/" target="_blank">WordPress</a>'); 
} 
add_action('barletta_footer', 'barletta_footer_credits'); 

改變與繼

function barletta_footer_credits() { 
?> 
<div class="site-info"> 
<?php if (get_theme_mod('barletta_footer_text') == '') { ?> 
&copy; <?php echo date('Y'); ?> <?php bloginfo('name'); ?><?php esc_html_e('. All rights reserved.', 'barletta'); ?> 
<?php } else { echo esc_html(get_theme_mod('barletta_footer_text', 'barletta')); } ?> 
</div><!-- .site-info --> 

} 
add_action('barletta_footer', 'barletta_footer_credits'); 

這只是去掉

整塊
<?php 
$nofollow=""; 
if (!is_home()) { $nofollow="rel=\"nofollow\""; } 
printf(esc_html__('Theme by %1$s Powered by %2$s', 'barletta') , '<a href="http://moozthemes.com/" target="_blank" '.$nofollow.'>MOOZ Themes</a>', '<a href="http://wordpress.org/" target="_blank">WordPress</a>');