Created
December 12, 2017 06:13
-
-
Save VicVicos/3e0ed28983062f838556a991a66cea74 to your computer and use it in GitHub Desktop.
Rewrite rule url for custom post type WP and other...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class CFunctions | |
| { | |
| public function __construct () | |
| { | |
| add_action('init', [$this, 'rewrite_rule_cpost']); | |
| } | |
| public function rewrite_rule_cpost() | |
| { | |
| $post_type = 'avada_portfolio'; | |
| add_rewrite_tag( "%avada_portfolio%", '([^/]+)', "post_type=$post_type&name=" ); | |
| $permastruct = "nefteprodukty/%avada_portfolio%"; // наша структура ЧПУ | |
| $args = array( | |
| 'with_front' => true, | |
| 'paged' => true, | |
| 'ep_mask' => EP_NONE, | |
| 'feed' => false, | |
| 'forcomments' => false, | |
| 'walk_dirs' => false, | |
| 'endpoints' => false, | |
| ); | |
| add_permastruct( $post_type, $permastruct, $args ); | |
| } | |
| } | |
| new CFunctions(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment