Guest User

Untitled

a guest
Apr 19th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. 'rewrite' => array(
  2. 'slug' => 'catalog/%product-cat%',
  3. 'with_front' => false
  4. ),
  5.  
  6. add_filter('post_type_link', 'product_type_permalink', 10, 4);
  7.  
  8. //session_product is the custom field in the session CPT that references a product
  9. if (!empty(get_post_meta( $id, 'session_product', true ))) {
  10.  
  11. //gets the product id
  12. $id_product = get_post_meta( $id, 'session_product', true );
  13.  
  14. //gets the product title
  15. $title_product = get_the_title($id_product);
  16.  
  17. //gets the permalink
  18. $permalink_product = get_post_permalink($post = $id_product, $leavename = false);
  19.  
  20. }
  21.  
  22. catalog/%product-cat%/a-custom-post
Advertisement
Add Comment
Please, Sign In to add comment