- This topic has 7 replies, 3 voices, and was last updated 9 years, 7 months ago by Theme Horse Support Team.
-
AuthorPosts
-
March 15, 2015 at 11:22 am #23113downtownukParticipant
I have created Attitude Child and added the following code into functions.php. But the footer is displayed as “Copyright © [the-year] [site-link]”. Please how can I fix this?
<?php
// Remove old copyright text
add_action( ‘init’ , ‘mh_remove_copy’ , 15 );
function mh_remove_copy() {
remove_action( ‘attitude_footer’, ‘attitude_footer_info’, 30 );
}// Add my own copyright text
add_action( ‘attitude_footer’ , ‘mh_footer_info’ , 30 );
function mh_footer_info() {
$output = ‘<div class=”copyright”>’.’Copyright © [the-year] [site-link]’.'</div><!– .copyright –>’;
echo do_shortcode( $output );
}March 16, 2015 at 6:55 am #23145Theme Horse Support TeamKeymasterHi downtownuk,
the above shorcodes falls under the plugins territory now. So we cannot use such shortcode inside the theme. you may use below code in your child theme. Hope this may help you.
$output = '<div class="copyright">'.__( 'Copyright ©', 'attitude' ).' '.attitude_the_year().' ' .attitude_site_link().' | ' . ' '.__( 'Theme by:', 'attitude' ).' '.attitude_themehorse_link().' | '.' '.__( 'Powered by:', 'attitude' ).' '.attitude_wp_link() .'</div><!-- .copyright -->';
Thank you!
March 22, 2015 at 10:20 am #23343downtownukParticipantI am getting this error when I replaced the code below “// Add my own copyright text” with the new code. Please how can I fix this?
Fatal error: Call to undefined function attitude_the_year() in /home4/downtown/public_html/wp-content/themes/attitude-child/functions.php on line 11
March 23, 2015 at 5:33 am #23367Theme Horse Support TeamKeymasterHi downtownuk,
Once check in your child theme under functions.php on line no 11. I think there you have defined other functions.
// Unhook default Thematic functions function unhook_thematic_functions() { // Don't forget the position number if the original function has one remove_action( 'attitude_footer', 'attitude_footer_info', 30 ); } add_action('init','unhook_thematic_functions'); add_action( 'attitude_footer', 'attitude_footer_info', 30 ); /** * function to show the footer info, copyright information */ function attitude_footer_info() { $output = '<div class="copyright">'.__( 'Copyright ©', 'attitude' ).' '.attitude_the_year().' ' .attitude_site_link().' | ' . ' '.__( 'Theme by:', 'attitude' ).' '.attitude_themehorse_link().' | '.' '.__( 'Powered by:', 'attitude' ).' '.attitude_wp_link() .'</div><!-- .copyright -->'; echo $output; }
hope this may help you
Thank you!
April 6, 2015 at 8:50 pm #23808shawnhoffmanParticipantI had the same problem and figured out a solution with this:
// Remove old copyright text add_action( 'init' , 'mh_remove_copy' , 15 ); function mh_remove_copy() { remove_action( 'attitude_footer', 'attitude_footer_info', 30 ); } // Add my own copyright text add_action( 'attitude_footer' , 'mh_footer_info' , 30 ); function mh_footer_info() { $output = '<div class="copyright">'.'Copyright © '.attitude_the_year().' ' .attitude_site_link().''.'</div><!-- .copyright -->'; echo do_shortcode( $output ); }
So really you only have to change
[the-year] [site-link]
into
'.attitude_the_year().' ' .attitude_site_link().'
And it works for me — but the pros can tell me if that is a good way or not, maybe there is some flaw to it?
April 7, 2015 at 9:09 am #23822Theme Horse Support TeamKeymasterThat’s great shawnhoffman,
Yes you may change it. But while customizing the code its necessary to create a child theme to be safe from data loss while updating to our new version.
Thank you!
April 7, 2015 at 10:23 am #23826shawnhoffmanParticipantYes, of course. I put that code in the child theme’s functions.php. Glad to know it’s a good solution and I hope it helps someone else.
April 8, 2015 at 4:53 am #23859Theme Horse Support TeamKeymasterYes exactly it will help someone else. Thanks for helping us too.
Thank you!
-
AuthorPosts
- You must be logged in to reply to this topic.