- This topic has 10 replies, 3 voices, and was last updated 1 year, 5 months ago by David.
-
AuthorPosts
-
October 30, 2022 at 8:16 am #2394170George
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 #2394320LeoStaffCustomer SupportHey George,
I’m sure Tom and Jean will take a look at the Github issue and respond there.
Thanks for mentioning it!
October 30, 2022 at 12:06 pm #2394344GeorgeCan you recreate it on your end, Leo?
November 6, 2022 at 2:09 pm #2404004GeorgeNo 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 #2404568DavidStaffCustomer 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.
November 7, 2022 at 4:08 am #2404586GeorgeThanks 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 #2404647DavidStaffCustomer 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.
November 7, 2022 at 5:58 am #2404693GeorgeOk, thanks, David, I will find another solution.
November 7, 2022 at 6:51 am #2404742DavidStaffCustomer SupportBe nice if WP added this to core links, its such an oversight by them.
I hope you find a good solution.
November 7, 2022 at 7:55 am #2404976GeorgeYeah, 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 #2405935DavidStaffCustomer SupportGood to see that George. Thanks for sharing!!
-
AuthorPosts
- You must be logged in to reply to this topic.