Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. <?php
  2.  
  3. if (!defined('ABSPATH')) exit;
  4.  
  5. // hardcode the page slug using a constant if neccesary
  6. define('THEME_NAME_PRODUCTS_PAGE_SLUG', 'books/');
  7.  
  8. function theme_name_product_page_slug($include_domain = true)
  9. {
  10. return $include_domain ? network_home_url(THEME_NAME_PRODUCTS_PAGE_SLUG) : THEME_NAME_PRODUCTS_PAGE_SLUG;
  11. }
  12.  
  13.  
  14. // ACF Settings will need to be setup to make these functions usable
  15. // To set up a page link, create a new Post Object field and set it to return the post ID.
  16. // It is advisable to add these options to Theme Settings ACF page
  17.  
  18. // get product detail page ID
  19. function theme_name_product_detail_page_ID()
  20. {
  21. return get_field('theme_product_detail_page', 'option');
  22. }
  23.  
  24. // get product detail page link
  25. function theme_name_product_detail_page_slug()
  26. {
  27. return get_the_permalink(theme_name_product_detail_page_ID());
  28. }
  29.  
  30. // get contact page ID
  31. function theme_name_contact_page_ID()
  32. {
  33. return get_field('theme_contact_page', 'option');
  34. }
  35.  
  36. // get contact page link
  37. function theme_name_contact_page_slug()
  38. {
  39. return get_the_permalink(theme_name_contact_page_ID());
  40. }
  41.  
  42. // Get Search Page ID
  43. function theme_name_search_page_ID()
  44. {
  45. return get_field('theme_search_page', 'option');
  46. }
  47.  
  48. // get search page slug
  49. function theme_name_search_page_slug()
  50. {
  51. return get_the_permalink(theme_name_search_page_ID());
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement