Last active
April 23, 2019 07:47
-
-
Save anthonydelgado/d7c640d6044000479197 to your computer and use it in GitHub Desktop.
load page with ajax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onload = function(){ | |
var aboutdata = null; | |
$.get( "/about-us/?ajax=true", function( data ) { | |
aboutdata = data; | |
$( "#menu-item-23" ).click(function() { | |
event.preventDefault(); | |
$( "body" ).html(aboutdata); | |
}); | |
}); | |
}; // END window.onload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Roots\Sage\Setup; | |
use Roots\Sage\Wrapper; | |
?> | |
<?php if (isset($_GET['ajax'])) { ?> | |
<body <?php body_class(); ?>> | |
<!--[if IE]> | |
<div class="alert alert-warning"> | |
<?php _e('You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.', 'sage'); ?> | |
</div> | |
<![endif]--> | |
<?php | |
do_action('get_header'); | |
get_template_part('templates/header'); | |
?> | |
<div class="wrap no-container" role="document"> | |
<div class="content row"> | |
<main class="main" id="main-container-wrapper"> | |
<?php include Wrapper\template_path(); ?> | |
</main><!-- /.main --> | |
<?php if (Setup\display_sidebar()) : ?> | |
<aside class="sidebar"> | |
<?php include Wrapper\sidebar_path(); ?> | |
</aside><!-- /.sidebar --> | |
<?php endif; ?> | |
</div><!-- /.content --> | |
</div><!-- /.wrap --> | |
<?php | |
do_action('get_footer'); | |
get_template_part('templates/footer'); | |
wp_footer(); | |
?> | |
</body> | |
<?php }else{ ?> | |
<!doctype html> | |
<html <?php language_attributes(); ?>> | |
<?php get_template_part('templates/head'); ?> | |
<body <?php body_class(); ?>> | |
<!--[if IE]> | |
<div class="alert alert-warning"> | |
<?php _e('You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.', 'sage'); ?> | |
</div> | |
<![endif]--> | |
<?php | |
do_action('get_header'); | |
get_template_part('templates/header'); | |
?> | |
<div class="wrap no-container" role="document" id="document-wrap"> | |
<div class="content row"> | |
<main class="main" id="main-container-wrapper"> | |
<?php include Wrapper\template_path(); ?> | |
</main><!-- /.main --> | |
<?php if (Setup\display_sidebar()) : ?> | |
<aside class="sidebar"> | |
<?php include Wrapper\sidebar_path(); ?> | |
</aside><!-- /.sidebar --> | |
<?php endif; ?> | |
</div><!-- /.content --> | |
</div><!-- /.wrap --> | |
<?php | |
do_action('get_footer'); | |
get_template_part('templates/footer'); | |
wp_footer(); | |
?> | |
</body> | |
</html> | |
<?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment