Created
September 5, 2017 12:21
-
-
Save westcoastdigital/b7bd1f277d66bdd4fec816a16cb0a883 to your computer and use it in GitHub Desktop.
Custom copyright in GeneratePress whilst still allowing the customiser control to be used
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Add this to your functions.php of your child theme | |
| function generatepress_custom_copyright() { | |
| $copyrightCustomizer = get_theme_mod('generate_copyright'); | |
| if ( !empty($copyrightCustomizer) ) { | |
| $date = date('Y'); | |
| $copyrightCustomizer = str_replace( '%current_year%', $date, $copyrightCustomizer ); | |
| $copyright = str_replace( '%copy%', '©', $copyrightCustomizer ); | |
| // change this to what you want after the copyright | |
| $copyright .= ' | Website built on the <a href="https:$copyrightCustomizer//generatepress.com/">GeneratePress Theme</a>'; | |
| } else { | |
| // change this for default copyright if customizer is empty | |
| $copyright = sprintf( '<span class="copyright">© %1$s</span> • <a href="%2$s" target="_blank" itemprop="url">%3$s</a>', | |
| date( 'Y' ), | |
| esc_url( 'https://generatepress.com' ), | |
| __( 'GeneratePress','generatepress' ) | |
| ); | |
| } | |
| return $copyright; | |
| } | |
| add_filter( 'generate_copyright','generatepress_custom_copyright' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment