[Resolved] Reopening ticket Add target="_blank" to repeating fields
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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Hi there,
I'm reopening the ticket https://toolset.com/forums/topic/add-target_blank-to-repeating-fields/#post-2465689
because on a page that's built basically the same way, I have also other file types (doc, xls) with classes "special-link-doc" and "special-link-xls" .
For these I tried to edit the code your supporter Waqar gave me:
It's not working though, showing a blank line..maybe because it's supposed to display these in a sequence but the code is not "telling this to the system"?
Could you please look into this? Access is the same as previous ticket
This is the page: hidden link
Screenshots to clarify.
thank you!
I checked the view and noticed that the conditional block for the "File DOC" field in the first view, was not functioning correctly. The most likely cause could be some invalid character code while copying/pasting the code.
I removed that conditional block and the enclosed repeating field block, added it again, and used the following custom code in the settings for the 3 repeating field blocks, and the icon and the links seem to be working now:
Thank you again, Waqar.
Only when I open the editor of the page the blocks seem to encounter an error (it's happened ever since adding the custom code). If I click on the "Attempt to restore the block" button, it goes away. But I'm wondering if it's ok like that (see screenshot).
I can think of another alternate, that will not involve adding custom code in the "Repeating Field" block, which is causing this error.
You can set the "Display Mode" option back to "Separated by" (from "Custom"), the way it was before. And in the "File link extra classes" field of the block, you can include one extra class "new-tab-link", so that all these links can be targeted through a single common class.
For example:
For docs links, these will be the two classes:
special-link-doc new-tab-link
For xls links, these will be the two classes:
special-link-xls new-tab-link
For pdf links, these will be the two classes:
special-link-pdf new-tab-link
After that, you can include the following custom script in the View block's "Custom JS" field:
Thank you, Waqar, always helpful.
It turns out your last solution works well but conflicts with my our caching plugin.. I'll stick with the first solution for the moment.
Have a great day
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.