Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!defined('ABSPATH')) exit;
- // hardcode the page slug using a constant if neccesary
- define('THEME_NAME_PRODUCTS_PAGE_SLUG', 'books/');
- function theme_name_product_page_slug($include_domain = true)
- {
- return $include_domain ? network_home_url(THEME_NAME_PRODUCTS_PAGE_SLUG) : THEME_NAME_PRODUCTS_PAGE_SLUG;
- }
- // ACF Settings will need to be setup to make these functions usable
- // To set up a page link, create a new Post Object field and set it to return the post ID.
- // It is advisable to add these options to Theme Settings ACF page
- // get product detail page ID
- function theme_name_product_detail_page_ID()
- {
- return get_field('theme_product_detail_page', 'option');
- }
- // get product detail page link
- function theme_name_product_detail_page_slug()
- {
- return get_the_permalink(theme_name_product_detail_page_ID());
- }
- // get contact page ID
- function theme_name_contact_page_ID()
- {
- return get_field('theme_contact_page', 'option');
- }
- // get contact page link
- function theme_name_contact_page_slug()
- {
- return get_the_permalink(theme_name_contact_page_ID());
- }
- // Get Search Page ID
- function theme_name_search_page_ID()
- {
- return get_field('theme_search_page', 'option');
- }
- // get search page slug
- function theme_name_search_page_slug()
- {
- return get_the_permalink(theme_name_search_page_ID());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement