Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在php中更改链接值_Php_Wordpress - Fatal编程技术网

在php中更改链接值

在php中更改链接值,php,wordpress,Php,Wordpress,我是wordpress的新手,一直在使用以下代码: div class="hd-box-wrap"> h2> a href=" ?php the_permalink();?>">?php the_title();?></a>/h2> div class=“hd包装盒”> h2>a href=“?php the_permalink();?>”>?php the_title();?>

我是wordpress的新手,一直在使用以下代码:

div class="hd-box-wrap">                                
h2> a href=" ?php the_permalink();?>">?php the_title();?></a>/h2>  
div class=“hd包装盒”>
h2>a href=“?php the_permalink();?>”>?php the_title();?>/h2>
现在假设这个超链接给了我一个值

www.google.com/ankit

但我需要我的页面转到

www.google.com/ankit1

我试过了

div class="hd-box-wrap">                                
h2> a href=" ?php the_permalink();?1>">?php the_title();?></a>/h2>  
div class=“hd包装盒”>
h2>a href=“?php the_permalink();?1>”>?php the_title();?>/h2>
但我不知道剩下的是什么。使用substr_replace()函数将最后一个字符从/更改为1是没有错误的 像这样:

a href=" <?php substr_replace(the_permalink(), "1", -1); ?>"
a href=“”
像这样尝试:

<div class="hd-box-wrap">
    <h2>
        <a href="<?php the_permalink();?>1"><?php the_title();?></a>
    </h2>
</div>


您可以按{}图标将代码包装在一个块中,该块将阻止您使用“sorry its take as instead”执行操作,因此函数返回“ankit/”,您希望它转到“”?不,我希望它转到ankit1。实际上,这是一个指向公文包的公文包页面。我想将它指向另一个页面localhost/wordpress/portfolio/ankit1或localhost/wordpress/ankit或localhost/wordpress/ankit1。任何事情都会成功,因为我会给我的新页面相同的URL更新了我的答案,它给出的输出是/ankit/1而不是ankit1那么
1