2016-12-05 73 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>');