function iframe_popup_posts() { 
?>
<script type="text/javascript">
(function($){
$(window).on('load', function () {
  
	if (top === self) { 
	// no frame
	} else { //frame 
		$('#header, #footer, #socket, .sidebar, .av-curtain-footer-container').hide();
		$('#main').css('padding-top', '0');
		$('.container .av-content-small').css('width', '100%');
		$('.content').css('border-right', 'none');
	};

	$('.iframe-popup-link').find('a').addClass('no-scroll');

	$('.iframe-popup-link a').magnificPopup({
	    type:'iframe',
	    removalDelay: 1000,
	    closeOnContentClick: false,
	    mainClass: 'mfp-3d-unfold mfp-page-content',
	    callbacks: {
	      beforeOpen: function() { 
	        this.st.iframe.markup = this.st.iframe.markup.replace('mfp-iframe-scaler', 'mfp-iframe-scaler mfp-with-anim');
	      },
	    },
	});
 });   
})(jQuery);
</script>
<?php 
}
add_action('wp_footer', 'iframe_popup_posts', 999);