Hello, I don’t write PHP (yet) and would love someone to help me design a line or two. I have posted a complete php page below for a Wordpress template. By default the code causes any feature link to open in target="_blank"
I would like to change the default to target="_self" (this part I can do) but then I would like to make one link to an external site open using target="_blank"
I am happy to add individual site urls for any exceptions to the default rule. I have tried a few times to change myself but I am not experienced in PHP and don’t know the best way or correct code. Let me know if you need any more, many thanks in advance - Lanx
I hope you realize that if you change the code here, the next time this theme comes out with an update, it will overwrite any changes you make, and you will have to do it all over again.
Or just Google “How to create a child theme”. Modify the child theme, and not that main theme, so that if you update the main one, you won’t lose your custom code.
Many thanks for your help Jeffrey. I just posted the new code into the page (replacing the old section) with two specified urls to test it. The local links opened up fine using target=“self” as desired but unfortunately the specified url I wanted to open with target=“blank” also opened in the same window (self). Do you have any ideas why this might be? Thanks again for your time.
Thanks for the links Jeffrey, I have two new sites to build and will definitely start to use child themes for them. They would certainly have saved me a few headaches in the past too. Thanks for the quick responses by the way, it’s my first time on a forum like this, the help is really appreciated.
Did you replace the with the exact url as it is in that $wpex_feature_url variable? It would need to be exactly the same character for character, www., http or https, etc.
(I just realised the post got rid of these brackets < > but I left them in on the second link above. A silly mistake, easy to fix, I am very happy.)
The linked site also needs a lot of work but I’ll get there. I’m working on 5 at the moment. Thanks again for your help. I can now progress with the other tasks I have and the first will be a child site for 3 of my new websites. Much appreciated, have a great day!!!