We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3349
    • 126 Posts
    How can I set a target="_new" in a weblink in modx?

    I’ve tried using the link attribute field but it doesn’t work....

    Help please...

    bS
      • 21257 MODX Staff
      • 730 Posts
      Are you using a snippet to output the links in question into your template? Is it Wayfinder? Ditto?

        Mike Schell
        Lead Developer, MODX Cloud
        Email: [email protected]
        GitHub: https://github.com/netProphET/
        Twitter: @mkschell
        • 3349
        • 126 Posts
        Hi

        Im using the wayfinder snippet...

        bS
          • 33337
          • 3,975 Posts
          Try adding target="_new" in Link Attributes field.
            Zaigham R - MODX Professional | Skype | Email | Twitter

            Digging the interwebs for #MODX gems and bringing it to you. modx.link
            • 3349
            • 126 Posts
            I have tried this but nothing renders out in the link code, as I expected it would...

            ???
              • 21257 MODX Staff
              • 730 Posts
              I just wandered through the Wayfinder code, and it definitely looks like it’s meant to make use of Link Attributes.
              I recall not being able to get Link Attributes to work a while back. I wonder if the database query isn’t returning the link attribute properly, or if the placeholder replacement isn’t working for some reason. Are you also using PHx?
                Mike Schell
                Lead Developer, MODX Cloud
                Email: [email protected]
                GitHub: https://github.com/netProphET/
                Twitter: @mkschell
                • 21257 MODX Staff
                • 730 Posts
                If you’re using a custom template for the rows/links in Wayfinder, did you include the attributes placeholder?
                This is Wayfinder’s default template.. see how it has [+wf.attributes+] in the link:
                <a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a>
                
                  Mike Schell
                  Lead Developer, MODX Cloud
                  Email: [email protected]
                  GitHub: https://github.com/netProphET/
                  Twitter: @mkschell
                  • 3349
                  • 126 Posts
                  This is so strange?

                  I checked the wayfinder.inc.php file (assuming this is the correct file?) and indeed found the following line:

                  <a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a>

                  But yet i can’t get any code placed inside the link attribute field to render out????

                  Any ideas?

                  bS
                    • 3349
                    • 126 Posts
                    Found it!

                    I now realise that the extra chunks I was using for the wayfinder navigation never included the call to the attributes. I was looking too deep into the snippet code!!

                    Thanks again

                    bS