Site logo

[Resolved] How to insert copyright message into footer element

Home Forums Support [Resolved] How to insert copyright message into footer element

Home Forums Support How to insert copyright message into footer element

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1916124
    Daniel

    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.

    #1916166
    Elvin
    Staff
    Customer Support

    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.

    #1917041
    Daniel

    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.

    #1917147
    Elvin
    Staff
    Customer Support

    Ah yes, it was thinking it could be that.

    Glad you got it sorted. 😀

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