- This topic has 31 replies, 3 voices, and was last updated 3 years, 4 months ago by
Fernando.
-
AuthorPosts
-
November 17, 2022 at 11:49 pm #2420905
RYAN
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
November 18, 2022 at 12:05 am #2420913Fernando Customer Support
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?
November 18, 2022 at 12:13 am #2420925RYAN
Like this, it appears at the bottom of each article page, not at the footer
November 18, 2022 at 12:29 am #2420950Fernando Customer Support
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_footerfor 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?
November 18, 2022 at 12:32 am #2420952RYAN
Yes, the copyright notice displayed in the screenshot corresponds to all articles. How to set this
November 18, 2022 at 12:38 am #2420967Fernando Customer Support
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?
November 18, 2022 at 12:43 am #2420972RYAN
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
November 18, 2022 at 12:55 am #2420988Fernando Customer Support
I see.
1. Create a Block Element – Hook. Hook it to
before_footer. Set the Display rule location toPost - 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, addcu-headline-linkto 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.November 25, 2022 at 1:05 am #2432445RYAN
Why can’t I find the “Post – All Posts” option?
November 25, 2022 at 1:15 am #2432458Fernando Customer Support
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
November 25, 2022 at 1:43 am #2432510RYAN
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
November 25, 2022 at 5:28 am #2432872David
StaffCustomer SupportHi 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 thecu-headline-linkin that field.November 25, 2022 at 5:35 am #2432875RYAN
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
November 25, 2022 at 6:32 am #2433005David
StaffCustomer SupportThe
cu-headline-linkis 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-linkit will replace whatever was in that block with the Permalink ( Link to Article ).December 1, 2022 at 12:44 am #2444046RYAN
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 -
AuthorPosts
- You must be logged in to reply to this topic.