I want to pass the sub category id number from a post link <a href="<?php the_permalink() ?>">
is there any solution to pass the value from one page to another through link.
we can pass the id as href=?id= and we can get value from at single post as a link will be www.example/post1/?id=22 Which will be dynamic link of a single post and I just need www.example/post1/ a single link and pass the value to single-post page is that possible.
I want to pass the sub category id number from a post link <a href="<?php the_permalink() ?>">
is there any solution to pass the value from one page to another through link.
we can pass the id as href=?id= and we can get value from at single post as a link will be www.example/post1/?id=22 Which will be dynamic link of a single post and I just need www.example/post1/ a single link and pass the value to single-post page is that possible.
1 Answer
Reset to default 1the_permalink()
only displays the URL for the current post in the loop. If you want to link to another post, you can use echo get_the_permalink( 123 );
, where 123
is a post ID.
<a href="<?php echo get_the_permalink( 123 ) ?>">
Note that the_permalink()
and get_the_permalink()
only get URLs for posts. If you want to get the URL for a category (or tag, or other taxonomy term) you need to use get_term_link()
:
<a href="<?php echo get_term_link( 123 ) ?>">
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744966488a4603711.html
评论列表(0条)