- This topic has 10 replies, 3 voices, and was last updated 4 months, 3 weeks ago by
David.
-
AuthorPosts
-
October 30, 2022 at 8:16 am #2394170
George
Yoast has a functionality where you can select a link and assign
nofollow
andsponsored
link attributes.The functionality is not there for links that exist on GP elements, though. Is there a solution for this? I have also raised a GitHub issue.
October 30, 2022 at 11:32 am #2394320Leo
StaffCustomer SupportHey George,
I’m sure Tom and Jean will take a look at the Github issue and respond there.
Thanks for mentioning it!
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 30, 2022 at 12:06 pm #2394344George
Can you recreate it on your end, Leo?
November 6, 2022 at 2:09 pm #2404004George
No response at the GitHub issue, can we treat that as a support request, I don’t see getting a response anytime soon, Leo. It would help if you could recreate it at your end and comment on the issue.
November 7, 2022 at 3:50 am #2404568David
StaffCustomer SupportHi George,
see my reply to the Git here:
https://github.com/tomusborne/gp-premium/issues/374#issuecomment-1305424330
To cover, GP doesn’t stop those options from being displayed, Yoast simply doesn’t load on post types that are not public.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 7, 2022 at 4:08 am #2404586George
Thanks David, why does GP have public set to off? What would happen if public was set to true?
November 7, 2022 at 5:19 am #2404647David
StaffCustomer SupportThe default $public value for all CPTs is false.
You only make a CPTpublic
if it’s required.
Its quite a special arg in that it declares its not for public use and its value is inherited by many other args eg.Show in the main admin.
Show in the Menu builder
Is publicly queryable
Is included in Search results
Probably some other stuff too..All of which we Elements does not require.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 7, 2022 at 5:58 am #2404693George
Ok, thanks, David, I will find another solution.
November 7, 2022 at 6:51 am #2404742David
StaffCustomer SupportBe nice if WP added this to core links, its such an oversight by them.
I hope you find a good solution.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 7, 2022 at 7:55 am #2404976George
Yeah, true. Two ways to go about it:
1. Make use of a reusable block inside the element.
2. Filter the headline block with a class and add classes accordingly, like:add_filter( 'render_block', function( $block_content, $block ) { if ( !is_admin() && ('generateblocks/headline' === $block['blockName'] || 'core/paragraph' === $block['blockName']) && ! empty( $block['attrs']['className'] ) && 'add-nofollow' === $block['attrs']['className'] ) { $block_content = str_replace( '<a ', '<a rel="nofollow" ', $block_content ); } return $block_content; }, 10, 2 ); add_filter( 'render_block', function( $block_content, $block ) { if ( !is_admin() && ('generateblocks/headline' === $block['blockName'] || 'core/paragraph' === $block['blockName']) && ! empty( $block['attrs']['className'] ) && 'add-sponsored' === $block['attrs']['className'] ) { $block_content = str_replace( '<a ', '<a rel="sponsored" ', $block_content ); } return $block_content; }, 10, 2 ); add_filter( 'render_block', function( $block_content, $block ) { if ( !is_admin() && ('generateblocks/headline' === $block['blockName'] || 'core/paragraph' === $block['blockName']) && ! empty( $block['attrs']['className'] ) && 'add-nofollow add-sponsored' === $block['attrs']['className'] ) { $block_content = str_replace( '<a ', '<a rel="nofollow sponsored" ', $block_content ); } return $block_content; }, 10, 2 );
November 8, 2022 at 2:44 am #2405935David
StaffCustomer SupportGood to see that George. Thanks for sharing!!
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.