3 min read 0 comments

OnePress is a one-page theme for WordPress. The guys at FameThemes did a great job with the OnePress Theme as it’s one of the best one-page themes I’ve found.

I used this theme with just a logo image so the Copyright message at the footer was not displaying the company name along the “Copyright”.

In this article I will show you how to solve easily this problem, and without modifying any of the files of the theme, using the child theme method.

TLTR; You could skip directly to the Summing up section at the end.

OnePress Plus Theme

I really suggest buying the OnePress Plus Theme as it has many functionalities you or your clients would love to have.

alt text

Installing a Child Theme

For those who never used a child theme:

“A child theme is a theme that inherits the functionality and styling of another theme, called the parent theme. Child themes are the recommended way of modifying an existing theme.”

So if you don’t have one already for your OnePress theme, you will need to create it now.

Here more information on how to create a Child Theme from scratch, or here to download their OnePress Child Theme.

Changing the Copyright

I took their suggestion to Add a New Section through a child theme, and instead I customized the Copyright on the footer, using the same method: overwriting the function which takes care of showing the site info on the footer.

Such function is eventually created in inc/template-tags.php and it can be overwritten creating one with the same name in the functions.php of your child theme.

This is the function you can add at the end of the file functions.php of your child theme

if ( ! function_exists( 'onepress_footer_site_info' ) ) {
    /**
     * Add Copyright and Credit text to footer
     * @since 1.1.3
     */
    function onepress_footer_site_info()
    {
        ?>
        <?php printf(esc_html__('Copyright %1$s %2$s %3$s', 'onepress'), '&copy;', esc_attr(date('Y')), esc_attr(get_bloginfo())); ?>
        <span class="sep"> &ndash; </span>
        <?php printf(esc_html__('%1$s theme by %2$s', 'onepress'), '<a href="' . esc_url('https://www.famethemes.com/themes/onepress', 'onepress') . '">OnePress</a>', 'FameThemes'); ?>
        <?php
    }
}

Note that I removed the call to the function add_action() which normally would be just right after the last closing curly bracket. There is no need to call it again, since it will be called in the theme’s file inc/template-tags.php.

As you can see, the name of the company to which the website would belong to, is given by the value returned by the function get_bloginfo().

In case one configures the theme to be using only the logo image, this value would be empty. For this reason, one should change get_bloginfo() to any string in between quotas, so for example this line

<?php printf(esc_html__('Copyright %1$s %2$s %3$s', 'onepress'), '&copy;', esc_attr(date('Y')), esc_attr(get_bloginfo())); ?>

would becoming something like

<?php printf(esc_html__('Copyright %1$s %2$s %3$s', 'onepress'), '&copy;', esc_attr(date('Y')), esc_attr('Lore Pirri. All Rights Reserved.')); ?>

to get something like “Copyright © 2017 Lore Pirri. All Rights Reserved.” in the footer of your website.

TLTR - Summing up

To summarize in a few steps:

  1. Create a child theme for your OnePress Theme
  2. Add this function at the end of the file functions.php of your child theme

     if ( ! function_exists( 'onepress_footer_site_info' ) ) {
         /**
          * Add Copyright and Credit text to footer
          * @since 1.1.3
          */
         function onepress_footer_site_info()
         {
             ?>
             <?php printf(esc_html__('Copyright %1$s %2$s %3$s', 'onepress'), '&copy;', esc_attr(date('Y')), esc_attr(get_bloginfo())); ?>
             <span class="sep"> &ndash; </span>
             <?php printf(esc_html__('%1$s theme by %2$s', 'onepress'), '<a href="' . esc_url('https://www.famethemes.com/themes/onepress', 'onepress') . '">OnePress</a>', 'FameThemes'); ?>
             <?php
         }
       }
    
  3. Replace the code get_bloginfo() with a string within single quotes e.g. 'Lore Pirri. All Rights Reserved.'

     <?php printf(esc_html__('Copyright %1$s %2$s %3$s', 'onepress'), '&copy;', esc_attr(date('Y')), esc_attr('Lore Pirri. All Rights Reserved.')); ?>
    
  4. Done.



If this article was useful to you, please press the button Like or Share! If you have suggestions of improvement or you’ve found something wrong (conceptual or typo), please Comment down here, or feel free to Write me!