简体   繁体   English

重写EDD产品页面的规则

[英]Rewrite rules for EDD product page

I want my url changes depending on the term of taxonomy category_download custom post types download. 我希望根据分类术语category_download自定义帖子类型下载来更改网址。

Example: 例:

I have 2 categories: 我有2个类别:

– plugins –插件

– themes –主题

I wish I had a url for my single download: 我希望自己的下载网址为:

/plugins/name_of_download/ / plugins / name_of_download /

AND

/themes/name_of_download/ / themes / name_of_download /

Try adding this code to your themes functions.php file, 尝试将此代码添加到主题的functions.php文件中,

function __custom_messagetypes_link( $link, $term, $taxonomy )
 {
     if ( $taxonomy == 'plugins' ){

            return str_replace( 'plugins/', '', $link );

     }
     else if ( $taxonomy == 'themes' ){

             return str_replace( 'themes/', '', $link );    
     }
     else{

             return $link;
     }

 }
add_filter( 'term_link', '__custom_messagetypes_link', 10, 3 );

I am assuming the used slug, May be you have to change the your taxonomy slug if these are different. 我假设使用的子弹,如果这些不同,可能是您必须更改分类词。

If have any problem you can freely ask, Thanks, 如有任何问题,您可以自由询问,谢谢,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM