Site logo

Archived topic

How to insert copyright message into footer element

3 replies · Started by Daniel on September 1, 2021

Viewing posts 1–4 of 4

I'm using GP Pro and GB Pro.

I've configured my copyright message via the customiser > layout > footer.

I'm using a footer hook element and I can see a headline element with manually inserted "Your copyright message" text from the template element provided from the element library template. How can I include the configured copyright message into the footer element please?

This is a global block hook on generate_footer which is from the Stream library template.

Many thanks.

Hi Daniel,

While we can pull the text added on the copyright field by getting the value of get_theme_mod( 'generate_copyright' ), I'm not sure that's practical when we can just edit the Global Footer directly and copy+paste the contents of what's added on the copyright message added on the customizer.

We can display its value using a shortcode.

example:

add_shortcode( 'fetch_copyright_field', function() {
    ob_start();
    // Start your PHP below
  
    echo '<span class="generated-copyright">'.get_theme_mod( 'generate_copyright' ).'<span>';
  
    // End your PHP above
    return ob_get_clean();
} );

And use the shortcode [fetch_copyright_field] on a shortcode block but this seems like unnecessary extra steps as you will have to do custom CSS styling to this.

Ah, adding that as a shortcode is a brilliant idea. That will suit us perfectly, cheers!

The idea behind not wanting to change the block is to use the configuration screen for as much as possible so that theme/element changes can just pull in the configuration item.

Ah yes, it was thinking it could be that.

Glad you got it sorted. :D

This archived topic is closed to new replies.