我正在开发一个wordpress页面模板,就像this.我已经完成了设计,并加载了模板,一旦用户使用我的模板进入这个页面。我想在此模板中打开更多文章列表中的所有帖子,而不刷新页面。但当我点击列表中的任何帖子时,它会打开一个新页面,这与我的页面模板不同。请指导我如何在模板中打开的“更多文章”列表中打开帖子。这是我到目前为止的密码。
<?php if ( have_posts() ):
while ( have_posts() ) :
the_post(); ?>
<div id="main" class="left-half" style=" background-image: url(<?php echo intrigue_get_attachment(); ?>); width:50%; display: inline-block; float: right; position: fixed; ">
<h2 style="diplay:inline-block"><a href="<?php echo esc_url( home_url( \'/\' ) );?>"><?php bloginfo( \'name\' );?></a></h2>
<input id="morearticlesbtn" class="button" type="button" onclick="openNav()" value="More Articles ">
<div class="row">
<div class="post-meta col-md-6">
<p>July 18, 2017</p>
By: <a href="#">James Crock </a>
<a href="#"> Transport</a>
</div>
<div class="col-md-6">
<div class="line"></div>
</div>
</div>
<div class="title-div">
<a href="<?php echo the_permalink() ?>"> <h1 class="title"><?php the_title() ?></h1></a>
</div>
<div class="row">
<div class="col-md-9" >
<div class="line bottom-line"></div>
</div>
<div class="col-md-3 bottom-line-text">
<h4>Next</h4>
</div>
</div>
</div>
<div id="right" class="right-half" style="width: 50%; display: inline-block; float:right;">
<div class=" content-div">
<?php the_content();?>
</div>
<div class="tags content-div clear-fix">
<h6>Tags:</h6>
<?php echo get_the_tag_list();?>
<!-- <a href="#"><h6>Promotional</h6></a><a href="#"><h6>Pop-Ups</h6></a>-->
</div>
</div>
<?php endwhile; endif; ?>
<!--
THE OFFCANVAS MENU
-->
<div id="mySidenav" class="sidenav menu">
<div class="hidden-menu-div">
<input class="button close-button" type="button" onclick="closeNav()" value="Hide List ">
<div>
<a href="#">About</a>
<a href="#">Services</a>
<a href="#">Clients</a>
<a href="#">Contact</a>
<a href="#search">Search</a>
</div>
</div>
<?php
$temp = $wp_query; $wp_query= null;
$wp_query = new WP_Query(); $wp_query->query(\'posts_per_page=6\' . \'&paged=\'.$paged);
while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<div class="col-sm-6 hiden-cat-post">
<a href="<?php echo the_permalink(); ?>" class="hidden-cat-item">
<div class="hidden-cat-thumbnail" ><?php the_post_thumbnail(array(340, 230))?> </div>
<div class="hidden-cat-item-text">
<h1 class="hidden-cat-item-title"> <?php the_title(); ?> </h1>
<div class="excerpt"></div>
<div class="hidden-item-meta">jul 10,2017</div>
</div>
</a>
</div>
<?php endwhile; ?>
<?php if ($paged > 1) { ?>
<nav id="nav-posts">
<div class="prev"><?php next_posts_link(\'« Previous Posts\'); ?></div>
<div class="next"><?php previous_posts_link(\'Newer Posts »\'); ?></div>
</nav>
<?php } else { ?>
<nav id="nav-posts">
<div class="prev"><?php next_posts_link(\'« Previous Posts\'); ?></div>
</nav>
<?php } ?>
<?php wp_reset_postdata(); ?>
</div>
<!--
SCRIPT
-->
<script>
function openNav() {
document.getElementById("mySidenav").style.width = "50%";
document.getElementById("main").style.marginLeft = "50%";
}
function closeNav() {
document.getElementById("mySidenav").style.width = "0";
document.getElementById("main").style.marginLeft= "0";
}