在这个wordpress网站上,我们已经硬编码了一个按钮部分,可以将您带到页面上的网址。单击该按钮时,它不会将您带到URL - 而是刷新页面。必须是次要的,但会喜欢一些帮助。
<script>
(function($) {
$(document).ready(function() {
$(".green-btn").click(function(e) {
e.preventDefault();
window.location.href = "<?php echo $news_url; ?>";
return false;
});
});
}(jQuery));
</script>
这是HTML
<?php $news_url = get_permalink(26); ?>
<div class="article-meta hidden-phone">
<div class="span9 news-page">
<span class="article-meta-text">Posted on <span style="font-weight: bold;"><?php echo get_the_date(); ?></span></span>
</div>
<div class="span3">
<button class="green-btn"> BACK TO NEWS</button>
</div>
</div>
<section class="entry-content <?php echo $icon_class ?>">
<?php the_content( __( 'Continue reading <span class="meta-nav">→</span>' , 'customizr' ) ); ?>
<?php wp_link_pages( array( 'before' => '<div class="pagination pagination-centered">' . __( 'Pages:' , 'customizr' ), 'after' => '</div>' ) ); ?>
</section>