I want to go to single.php
file when this button is clicked.
JavaScript
x
<div class="recepies-search">
<div class="card m-1" style="width: 18rem;">
<img class="card-img-top" src="<?get_the_post_thumbnail()?>" >
<div class="card-body">
<h5 class="card-title"><?php the_title();?></h5>
<button type="button" class="btn btn-warning" onclick="<?php get_permalink()?>">click</button>
</div>
</div>
</div>
but it doesn’t do anything.
Advertisement
Answer
Replace this:
JavaScript
<button type="button" class="btn btn-warning" onclick="<?php get_permalink()?>">click</button>
with this:
JavaScript
<a href="<?php the_permalink() ?>">click</a>
And then style your a
tag like a button.