简体   繁体   中英

Wordpress how to get a single post link

I want to go to single.php file when this button is clicked.

<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.

Replace this:

<button type="button" class="btn btn-warning" onclick="<?php get_permalink()?>">click</button>

with this:

<a href="<?php the_permalink() ?>">click</a>

And then style your a tag like a button.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM