url rewriting - Change Wordpress comments urlword

Is this possible? For example, I want to change toWhat should I do to get it working? Is there any chance to fix this?Is

Is this possible? For example, I want to change


to


What should I do to get it working? Is there any chance to fix this?

Is this possible? For example, I want to change

http://mysitesitesite/post-name/comment-page-1/#comment-452

to

http://mysitesitesite/post-name/custonname-1/#customname-452

What should I do to get it working? Is there any chance to fix this?

Share Improve this question edited Aug 11, 2013 at 18:27 user1627363 asked Aug 4, 2013 at 11:43 user1627363user1627363 1724 silver badges21 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

In your functions.php add ( there are other rules relating to comment pages you can see them all with Rewrite Rules Inspector plugin, this one just covers the case you mention )

add_rewrite_rule (
  '(.?.+?)/customname-([0-9]{1,})/?$', 
  'index.php?pagename=$matches[1]&cpage=$matches[2]', 
  'top'
);

you'll also need to find in your theme ( possibly in your function.php ) where the comments are generated and change where the id is added to the comment html from something like ( if you can specify what theme your using can be more specific )

<li <?php comment_class('clearfix'); ?> id="comment-<?php comment_ID(); ?>">

to

<li <?php comment_class('clearfix'); ?> id="customname-<?php comment_ID(); ?>">

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745332890a4622965.html

相关推荐

  • url rewriting - Change Wordpress comments urlword

    Is this possible? For example, I want to change toWhat should I do to get it working? Is there any chance to fix this?Is

    5小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信