Option links inside "Flex Block"

Posted in: Newspaper
Post count: 8

Hello, I’m looking to apply the following option to a “flex block”: open all links in a new tab.

I can’t find the option available in the block itself…

How can I make the links of my articles to open in a new tab? I’ve seen that it’s possible to assign a CSS class, maybe there is a solution there Can you give me a hint on the name of the block itself to apply this special class that force to open articles in a new tab?

“When I add the following CSS code on my website :

.new-tab a {
target: _blank;
}

and apply the extra class “new-tab” to the flex bloc, it doesn’t work…

Do you have any solution to solve this issue please?

Post count: 27744

Hi,

You need to make changes in the theme files. You need to edit this file -> wp-content/plugins/td-composer/legacy/common/wp_booster/td_module.php and add the code here https://imgur.com/mtbsonl
Also, please check this topic https://forum.tagdiv.com/topic/open-all-posts-from-main-loop-in-new-tabwindow/

Thank you!

Post count: 8

Thanks for your answer but…

This did not work, does the PHP file you gave me allow modification of this block? [img]https://i.imgur.com/lMdJ8S1.jpg[/img]

I would also like to know if modifying the appropriate PHP file will impact the opening of links in other types of Flex blocks, such as Flex block 2, Flex block 3, etc. Ideally, I would only like to modify the behavior of the ‘Flex block 1’ module

Post count: 27744

Hello,

Please do the change here https://imgur.com/DrUdqvY in the same file, will apply to all flex blocks.

Thank you!

Post count: 8

Thank you for your answer, it’s working now!

But I also have a button below my article that still opens in the same page. I’ve tried to search inside your PHP file for the corresponding div class: “td-read-more,” but there is no such thing there.

Could you please show me where I can edit the behavior of this button? (It’s also inside the flex-block-1 module.)

Are there any tricks/possibilities to apply all these changes about the “open in new tab” link only for “Flex block 1” without impacting other flex block modules? Like using the extra-class field or other CSS options, or maybe another option by modifying this PHP file or inserting a JS script on the block template?

Post count: 21065

Hello!

You can contact our custom work team here: https://tagdiv.com/premium-customization-services/ and they can fully help you.

Thank you for your understanding!

Post count: 8

Thanks Bettina, I understand that creating a specific behavior for a block requires development work

However I would just like to know to simply add the same functionality as given previously by Anamaria for the image and title but this to the button. It’s just about to let me know the name used as the appropriate class in the previous file

Anamaria, what is the class associated with ‘td-read-more’ (button link) called in the ‘td-module.php’file please?”

Post count: 21065

Hello!

The class “td-read-more” appears in every module’s files. In order to modify it, you need to edit every file because there is no possibility to edit once and have it reflect on every block.

Thank you!

Post count: 8

I just want this behavior on the “flex-block-1” module (doesn’t matter if it’s apply automatically to others flex-block)

Previously, Anamaria show me a way that was working to edit link for the image and title through the “td_module.php” but I can’t see any class inside this document related to the term “button” or “read-more” to add the “_blank” (code to open it in new tab)

My guess is your technical team didn’t have name it in the same way, I just need to find the name class associated with the “read-more” (button with link) in the php file

Could you just provide me the name of this class in td_module.php file ?

Post count: 21065

Hello!

The file is located in “td-composer/legacy/Newspaper/includes/modules/td_module_flex_1.php” and the link is at line 169 and you can apply target blank.

Thank you!

Viewing 10 posts - 1 through 10 (of 10 total)
The forum ‘Newspaper’ is closed to new topics and replies.