Archived topic
How to add copyright information to the bottom of each article
31 replies · Started by RYAN on November 17, 2022
How to add copyright information to the bottom of each article, so that you don't have to add it every time you post an article
Hi Ryan,
The conventional way is to add it through Appearance > Customize > Layout > Footer. Reference: https://docs.generatepress.com/article/changing-the-copyright-message/
Are you planning to have unique copyright information per article? If so, what would the copyright look like? Would it be the title of the article/post?
Like this, it appears at the bottom of each article page, not at the footer
Will the Copyright statement shown in your screenshot be the same for all Articles?
In essence, you can use a Block Element - Hook. Hook it to before_footer for this section.
For the Article Title, you can use a GenerateBlocks Headline Block, and enable Dynamic data to retrieve the Title. Example: https://share.getcloudapp.com/E0uR2Z6m
Are you also looking to add the link?
Yes, the copyright notice displayed in the screenshot corresponds to all articles. How to set this
To clarify, are you also looking to add the unique title and link of each post as shown in the screenshot, or just the Copyright notice?
The copyright notice content displayed in the screenshot is unchanged and appears at the end of all articles. The title and link in the screenshot correspond to the title and chain of the article. How to set this
I see.
1. Create a Block Element - Hook. Hook it to before_footer. Set the Display rule location to Post - All Posts
2. Add a Container Block.
3. Add a Headline Block, and enable Dynamic data to retrieve the Title. Example: https://share.getcloudapp.com/E0uR2Z6m
4. Add another Headline Block, and enable Dynamic data to retrieve the Title as well. Set the link source to Single Post. Then, add cu-headline-link to the class list of this Headline Block. Then add this PHP snippet:
add_filter('generateblocks_dynamic_content_output', function($content, $attributes, $block){
if ( ! is_admin() && ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'cu-headline-link' ) !== false ) {
return get_permalink();
}
return $content;
}, 10, 3);
Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets
5. Add another Headline Block for the Copyright. Set the text to your preference.
Why can't I find the "Post - All Posts" option?
To clarify, is this not appearing?: https://share.getcloudapp.com/9Zuzr48w
If so, can you provide admin login credentials so we can check.
Please use the Private Information field for this: https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information
I can't understand the above step (add cu-headline-link to the class list of this Headline Block).
Is there a diagram to explain it
Hi there,
if you select the Headline Block, in sidebar settings go to Advanced. In there you will see a field: Additional CSS Class(es) add the cu-headline-link in that field.
What is a cu headline link? Is it an article link?
My current situation is that I don't know what a cu headline link is, so I'm stuck here now
The cu-headline-link is just a CSS Class, it could be named anything you like.
In Fernandos PHP Snippet:
add_filter('generateblocks_dynamic_content_output', function($content, $attributes, $block){
if ( ! is_admin() && ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'cu-headline-link' ) !== false ) {
return get_permalink();
}
return $content;
}, 10, 3);
You will see the class is referenced here: strpos( $attributes['className'], 'cu-headline-link' )
And that code when it finds a block with the CSS Class of cu-headline-link it will replace whatever was in that block with the Permalink ( Link to Article ).
Why is there such a big difference? What other places do I need to set up?
Can have the same effect as the first picture