Open link inside a div

0

I use a plugin to manage my posts in Wordpress , however I would like to make it open within a specific DIV .

Which in which is #main-view .

Today it looks like this: target="_parent"

Below is the code for the plugin.

<div class="gw-gopf-post">
	<div class="gw-gopf-post-header">
		<div class="gw-gopf-post-overlay">{{post_overlay_buttons}}</div>
		{{post_media}}
	</div>
	<div class="gw-gopf-post-content-wrap">
		<div class="gw-gopf-post-content">
			<div class="gw-gopf-post-title"><h2><a href="{{post_link}}" target="_parent">{{post_title}}</a></h2></div>
			
		</div>							
	</div>												
</div>
    
asked by anonymous 03.10.2017 / 22:58

1 answer

0

See if this code with XMLHttpRequest() works on your Wordpress:

Replace all <a></a> with this:

<a href='javascript: document.getElementById("main-view").innerHTML="Carregando...";xhr=new XMLHttpRequest();xhr.onreadystatechange=function(){if(xhr.readyState==4&&xhr.status==200){document.getElementById("main-view").innerHTML=xhr.responseText;}};xhr.open("GET","{{post_link}}",true);xhr.setRequestHeader("Content-type","text/html");xhr.send();' target="_parent">{{post_title}}</a>

This code will pull all the HTML of the desired URL into the% div #main-view (the URL must be from the same domain).

    
04.10.2017 / 00:31