Guest User

Untitled

a guest
Dec 14th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. <?php
  2. class CFunctions
  3. {
  4. public function __construct ()
  5. {
  6. add_action('init', [$this, 'rewrite_rule_cpost']);
  7. }
  8.  
  9. public function rewrite_rule_cpost()
  10. {
  11. $post_type = 'avada_portfolio';
  12.  
  13. add_rewrite_tag( "%avada_portfolio%", '([^/]+)', "post_type=$post_type&name=" );
  14. $permastruct = "nefteprodukty/%avada_portfolio%"; // наша структура ЧПУ
  15.  
  16. $args = array(
  17. 'with_front' => true,
  18. 'paged' => true,
  19. 'ep_mask' => EP_NONE,
  20. 'feed' => false,
  21. 'forcomments' => false,
  22. 'walk_dirs' => false,
  23. 'endpoints' => false,
  24. );
  25. add_permastruct( $post_type, $permastruct, $args );
  26. }
  27. }
  28. new CFunctions();
Add Comment
Please, Sign In to add comment