Skip Navigation

[Resolved] Open in a new tab “Post Title with a link” in Blocks

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to display Post Title with a Link using Blocks. When the User clicks the link, I would like to open it in a new tab.

Solution: One way to achieve this in blocks is to use a Container element, which you can set to be clickable, choose the post title as a link for the dynamic link source, and add a target of "_blank" to open the link in a new tab.

This support ticket is created 4 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 3 replies, has 2 voices.

Last updated by tomasT 4 years, 4 months ago.

Assisted by: Christian Cox.

Author
Posts
#1954221
Captura de pantalla 2021-02-17 a las 14.46.09.jpg
Captura de pantalla 2021-02-17 a las 15.41.03.jpg

Tell us what you are trying to do?
I am trying to set "Open in a new tab" (target="_blank") for the block "Post Title with a link".
The option is not available in the block editor sidebar, and using the HTML editor I have not clear where to enter the "target" attribute.

Is there any documentation that you are following?
https://toolset.com/documentation/customizing-sites-using-php/functions/#url

Is there a similar example that we can see?
hidden link (it is not done with toolset, but you can test the result I expect to get)

What is the link to your site?
hidden link (this is the page I would like to open new tabs when clicking on post titles)

Thank you very much.

#1954339
Captura de pantalla 2021-02-17 a las 16.20.46.jpg

I think I solved the issue setting a Div "Containter" with the post title inside. With "Container as a link" I got the area of the dynamic title to be a link with the option to "open in a new tab"

If it is possible, I would like to know if this one is the best solution or if you suggest any better one.

Thank you very much.

#1954767

Hi, the container element approach is probably the most effective way to accomplish this with blocks, since there is no easy way to modify the target attribute of a Post Title with Link dynamic source. Otherwise, I think a pure shortcode-based approach is required, and that kind of breaks the whole blocks paradigm. I think your solution is a good alternative for a blocks-based approach.

#1959695

Ok, I will leave it that way.
Thank you.