0

Instead of having the link opened in a new tab I would like to the link to be opened in an iframe that's on the same page.

Example: I have my front page with an iframe on it. If I click on the menu items i would like to have the urls loaded in the iframe.

I can't seem to find an answer for this.

1 Answers1

0

Alter the iframe in your front page as below

Make sure the iframe contains a name attribute (name="main-section")

<iframe name="main-section" src="home.html"></iframe>

In your menu items make sure the target attribute redirects to main-section (target="main-section"). This is an important step.

Example:

<a href="#" target="main-section"></a>

I am pretty sure you can achieve the above steps in wordpress.

Prashanth
  • 186
  • 3
  • 13
  • thanks. The problem I run in to is that I don't know how to change the _target of a menu item. The only option is "new tab". https://i.ibb.co/kgQ2HkY/menu.jpg – Maarten Nauw Sep 29 '20 at 14:00
  • I haven't worked on the latest Wordpress 3.x much but do give this a try https://www.agileana.com/blog/how-to-add-a-target-_blank-on-a-wordpress-menu-item/ It is definitely possible. In the worst case scenario you can directly edit the theme.php to add an extra attribute to the menu list. @MaartenNauw – Prashanth Sep 29 '20 at 14:08
  • I think I have to add code to the theme.php file to add an attribute. however I am not very experienced with coding. Hope you can help me out. – Maarten Nauw Sep 29 '20 at 14:13