admin管理员组文章数量:1326105
I'm using the ColorMag theme and I wanted to know how to edit the footer. What I've found is that:
<?php do_action( 'colormag_footer_copyright' ); ?>
Is showing the footer and I need to edit customizer.php
for that purpose but don't know what to edit as I've seen deleting a single line is resulting drastically so I don't want to risk more by random tries.
I'm using the ColorMag theme and I wanted to know how to edit the footer. What I've found is that:
<?php do_action( 'colormag_footer_copyright' ); ?>
Is showing the footer and I need to edit customizer.php
for that purpose but don't know what to edit as I've seen deleting a single line is resulting drastically so I don't want to risk more by random tries.
- Have you contacted the ColorMag themes support? – Tom J Nowell ♦ Commented May 13, 2017 at 12:47
5 Answers
Reset to default 2At first go to theme directory find inc>functions.php then search for "colormag_footer_copyright" edit this code bellow as you need:
add_action( 'colormag_footer_copyright', 'colormag_footer_copyright', 10 );
/**
* function to show the footer info, copyright information
*/
if ( ! function_exists( 'colormag_footer_copyright' ) ) :
function colormag_footer_copyright() {
$site_link = '<a href="' . esc_url( home_url( '/' ) ) . '" title="' . esc_attr( get_bloginfo( 'name', 'display' ) ) . '" ><span>' . get_bloginfo( 'name', 'display' ) . '</span></a>';
$wp_link = '<a href="https://wordpress" target="_blank" title="' . esc_attr__( 'WordPress', 'colormag' ) . '"><span>' . __( 'WordPress', 'colormag' ) . '</span></a>';
$tg_link = '<a href="https://themegrill/themes/colormag" target="_blank" title="'.esc_attr__( 'ThemeGrill', 'colormag' ).'" rel="designer"><span>'.__( 'ThemeGrill', 'colormag') .'</span></a>';
$default_footer_value = sprintf( __( 'Copyright © %1$s %2$s. All rights reserved.', 'colormag' ), date( 'Y' ), $site_link ).'<br>'.sprintf( __( 'Theme: %1$s by %2$s.', 'colormag' ), 'ColorMag', $tg_link ).' '.sprintf( __( 'Powered by %s.', 'colormag' ), $wp_link );
$colormag_footer_copyright = '<div class="copyright">'.$default_footer_value.'</div>';
echo $colormag_footer_copyright;
}
endif;
Login to your WordPress Dashboard.
Go to Appearance => Themes => Editor
Select inc/functions.php from the right side bar.
Search for colormag_footer_copyright and delete the following code.
$wp_link = '<a href="http://wordpress" target="_blank" title="' . esc_attr__( 'WordPress', 'colormag' ) . '"><span>' . __( 'WordPress', 'colormag' ) . '</span></a>';
From the below code, delete the code from br tag to end
$default_footer_value = sprintf( __( 'Copyright © %1$s %2$s. All rights reserved.', 'colormag' ), date( 'Y' ), $site_link ).'<br>'.sprintf( __( 'Theme: %1$s by %2$s.', 'colormag' ), 'ColorMag', $tg_link ).' '.sprintf( __( 'Powered by %s.', 'colormag' ), $wp_link );
After deleting the above code which is highlighted in bold, ensure that you have the following code:
$default_footer_value = sprintf( __( 'Copyright © %1$s %2$s. All rights reserved.', 'colormag' ), date( 'Y' ), $site_link );
After deleting the above code which is highlighted in bold, ensure that you have the following code:
$default_footer_value = sprintf( __( 'Copyright © %1$s %2$s. All rights reserved.', 'colormag' ), date( 'Y' ), $site_link );
Source
The action colormag_footer_copyright
echos a copyright note. if yout want to replace it with your name, you can do it like this:
add_action( 'colormag_footer_copyright', 'my_copyright', 10, 3 );
function my_copyright() {
echo '© Ishan Mahajan '.date('Y');
}
for example.
if you want to edit the whole footer you can edit the footer.php
in your theme folder.
Just comment out the theme and wordpress lines. In the inc/function.php file like this:
/*. '<br>' . sprintf( __( 'Theme: %1$s by %2$s.', 'colormag' ), 'ColorMag', $tg_link ) . ' ' . sprintf( __( 'Powered by %s.', 'colormag' ), $wp_link )*/;
FYI For some reason I can only do this in the colormag folder but not the child folder.
Also don't try to delete this line in footer.php
<?php do_action( 'colormag_footer_copyright' ); ?>
It will lose edit bar and other functions in customize.
You should never edit theme's files directly because you'll loose it on the next theme update. Here is what I did in my Child Theme functions.php
created of ColorMag 1.4.2:
// Function to add my copyright
function child_colormag_footer_copyright() {
echo '<div class="copyright">© My Copyright '.date('Y').'</div>';
}
// Function hook
add_action( 'colormag_footer_copyright', 'child_colormag_footer_copyright', 11 );
// Function to remove parent function
function child_remove_parent_function() {
remove_action( 'colormag_footer_copyright', 'colormag_footer_copyright');
}
// Hook removal function
add_action( 'wp_loaded', 'child_remove_parent_function' );
本文标签: How to edit footer
版权声明:本文标题:How to edit footer 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742193602a2430668.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论