return FALSE; $r = well_tag_thread__update(array('id' => $id), $update); return $r; } function well_tag_thread_find($tagid, $page, $pagesize) { $arr = well_tag_thread__find(array('tagid' => $tagid), array('id' => -1), $page, $pagesize); return $arr; } function well_tag_thread_find_by_tid($tid, $page, $pagesize) { $arr = well_tag_thread__find(array('tid' => $tid), array(), $page, $pagesize); return $arr; } ?>php - Add prefix to link url
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - Add prefix to link url

programmeradmin0浏览0评论

I want to add image link on wordpress site which redirect the user to the another page of same url but with different prefix. for example page url is mydomain/post1234 when user click the image on this page it redirect the user to the url mydomain/md/post1234

The following code print the current page url on every post page on site but i want to add "md" prefix in the url

<a href="<?php
$Path=$_SERVER['REQUEST_URI'];
$URI=''.$Path;
?>"><img src="<?php bloginfo('template_url'); ?>/images/sgxx.png">Click Here</a>

Pls suggest the correct code to do this.

I want to add image link on wordpress site which redirect the user to the another page of same url but with different prefix. for example page url is mydomain/post1234 when user click the image on this page it redirect the user to the url mydomain/md/post1234

The following code print the current page url on every post page on site but i want to add "md" prefix in the url

<a href="<?php
$Path=$_SERVER['REQUEST_URI'];
$URI='http://www.example'.$Path;
?>"><img src="<?php bloginfo('template_url'); ?>/images/sgxx.png">Click Here</a>

Pls suggest the correct code to do this.

Share Improve this question edited Jul 14, 2015 at 15:53 fuxia 107k38 gold badges255 silver badges459 bronze badges asked Jul 14, 2015 at 15:00 Harendra SinghHarendra Singh 213 bronze badges 1
  • Both of questions are related to permalinks structure. I don't want to change permalinks. I want to add image link on header of all pages which redirect the user of current page url but with prefix like current page url : example/post1234 redirect page url: example/md/post1234 – Harendra Singh Commented Jul 14, 2015 at 16:00
Add a comment  | 

1 Answer 1

Reset to default 1

Based on this question about retrieving Wordpress post slug, you could put together a link like the following:

<a href="http://www.example/md/<?php global $post; echo $post->post_name; ?>">link text</a>

Whether that goes to a functioning page or not, I don't know. It seems like you may want to change rewrite rules in the functions but I'm not sure from what you've said.

By the way, you may want to read why links that only say 'Click here' are bad practice for SEO and accessibility.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论