badget

Biggest Sale! Special Offer!

Get 30% discount on all of our single themes with this coupon code: #30%SALE

Hurry up! *Limited time offer*

[the-year] & [site-link] tags in footer not working..

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #23113
    downtownuk
    Participant

    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 );
    }

    #23145

    Hi 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 &copy;', 'attitude' ).' '.attitude_the_year().' ' .attitude_site_link().' | ' . ' '.__( 'Theme by:', 'attitude' ).' '.attitude_themehorse_link().' | '.' '.__( 'Powered by:', 'attitude' ).' '.attitude_wp_link() .'</div><!-- .copyright -->';

    Thank you!

    #23343
    downtownuk
    Participant

    I 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

    #23367

    Hi 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 &copy;', '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!

    #23808
    shawnhoffman
    Participant

    I 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 &copy; '.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?

    #23822

    That’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!

    #23826
    shawnhoffman
    Participant

    Yes, 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.

    #23859

    Yes exactly it will help someone else. Thanks for helping us too.

    Thank you!

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.