Wordpress如何获取单个postlink
Wordpress how to get a single post link
我想在单击此按钮时转到 single.php
文件。
<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>
但它什么也没做。
替换为:
<button type="button" class="btn btn-warning" onclick="<?php get_permalink()?>">click</button>
有了这个:
<a href="<?php the_permalink() ?>">click</a>
然后将您的 a
标签样式设置为按钮。
我想在单击此按钮时转到 single.php
文件。
<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>
但它什么也没做。
替换为:
<button type="button" class="btn btn-warning" onclick="<?php get_permalink()?>">click</button>
有了这个:
<a href="<?php the_permalink() ?>">click</a>
然后将您的 a
标签样式设置为按钮。