- This topic has 30 replies, 5 voices, and was last updated 3 months, 1 week ago by
Fernando.
-
AuthorPosts
-
February 3, 2023 at 2:06 am #2519729
Fernando Customer Support
I see. Set up the icon in the Icons section of the Block settings. Then, remove the Content source in the dynamic settings. Example: https://share.getcloudapp.com/v1uE8NOk
February 3, 2023 at 5:28 am #2519926Karan
Hello Fernando,
The link is not appearing in the hero section. Please check it once again. Earlier it was the text custom field. Not the Link custom field.
I have done it as you said. Still the link is not appearing.
Check screen shot for better understanding.
February 3, 2023 at 11:42 pm #2520872Karan
Hello Fernando, are you there…? Waiting for your response
February 4, 2023 at 5:49 am #2521071David
StaffCustomer SupportUse a GB Button Block.
1. Add the button,
2 Select the Icon,
3 Remove the Text so only the icon is displayed:https://docs.generateblocks.com/article/buttons-overview/#remove-text
4 Now set the Dynamic Data:
DATA SOURCE: Current Post
CONTENT SOURCE: DO NOT SET – LEAVE AS DEFAULT ( SELECT )
LINK SOURCE: POST META
POST META FIELD: Your custom field nameFebruary 4, 2023 at 7:13 am #2521152Karan
Hello David, I have done as you have said. But the link is still not working. Please check it.
Check the Screenshot and the URL.
And also i don’t want this social icon in every post as some people don’t have their social media account. How to do that?
February 4, 2023 at 8:30 am #2521347David
StaffCustomer SupportIf the button is not showing then it means the Custom Field has nothing inside it.
Make sure you a) have the correct custom field name, and b) on THAT page the custom field has a value inside it.February 5, 2023 at 10:29 pm #2522779Karan
Hello David, I have all the things You have mentioned as point a). and b).
Please check the screen shot for the same…!
February 6, 2023 at 12:44 am #2522855Fernando Customer Support
Can you try recreating the fields? Make sure to set the return value to Link URL before adding values to the Post Meta itself.
February 6, 2023 at 7:04 am #2523186Karan
Hello Fernando. I have done as you have said. Its still not happening…!
Please help me with it.
February 6, 2023 at 10:54 am #2523542Ying
StaffCustomer SupportCan you set the custom field type to URL, and update the Twitter link in the post editor?
February 6, 2023 at 11:45 am #2523590Karan
Hello Ying, Thank you for your response.
The link is working with the URL custom Field. But the link is opening in the same tab. I want it to open in new tab.
Please help me with it.
February 6, 2023 at 12:10 pm #2523611Ying
StaffCustomer SupportYou can add a CSS class eg.
new-tab
to the button block.
https://wordpress.com/support/wordpress-editor/adding-additional-css-classes-to-blocks/Then add this PHP snippet:
add_filter( 'render_block', function( $block_content, $block ) { if ( ! empty( $block['attrs']['className'] ) && strpos( $block['attrs']['className'], 'new-tab' ) !== false ) { $block_content = str_replace( '<a ', '<a target="_blank" ', $block_content ); } return $block_content; }, 10, 2 );
Adding PHP: https://docs.generatepress.com/article/adding-php/
If there’re any other headline/button blocks containing dynamic links and you want them to open in new tabs, just simply add the
new-tab
class to them.February 6, 2023 at 8:58 pm #2523974Karan
Hello Ying, Thanks for your response.
My Next question is. When i use the button block in the Hero GB element. The social icon is appearing in all the posts. For. ex. If the person doesn’t have any social account. in that case also the button will appear. I don’t want the button to appear on that case.
Please help me with this.
February 6, 2023 at 9:13 pm #2523989Fernando Customer Support
Hi Karan,
You can enable the “Remove Block if link is empty” option. Example: https://share.getcloudapp.com/4gu4qBbx
Let us know how it goes.
February 19, 2023 at 11:40 pm #2539387Karan
Thank You Fernando…!
-
AuthorPosts
- You must be logged in to reply to this topic.