Links to any template page from a Coupons CMS theme can generated by this function:
tlink( $type, optional $query_string );
Valid values for parameter $type:
- index – generate URL to homepage
- page – generate URL to website address and use query string
- stores – generate URL to stores template
- search – generate URL to search template
- user – generate URL to user page from directory “user”
- ajax – generate URL to an ajax page
- plugin – generate URL to a built-in plugin, not installed plugins
- whf – generate URL to a page which does not use header and footer
- tpage – generate URL to a custom page. Example: tpage/contact
- pay – generate URL to payments page
Example of using type “index”:
echo tlink( 'index' );
// return: http://example.org/
Example of using type “tpage”
echo tlink( 'tpage/contact' );
// return: http://example.org/contact.html
Example of using type “tpage” with query string:
echo tlink( 'tpage/contact', 'name=John&[email protected]' );
// return: http://example.org/contact.html?name=John&[email protected]
Generate links by element ID using this function:
get_link( $type, $id, optional boolean $return_object [default: false] );
return false if the id doesn’t exist
Valid values for parameter $type:
- coupon – or use alias function get_item_link( $id, optional $return_object )
- product – or use alias function get_product_link( $id, optional $return_object )
- store – or use alias function get_store_link( $id, optional $return_object )
- page – or use alias function get_page_link( $id, optional $return_object )
Example of using type “coupon”:
get_link( 'coupon', 1 );
// return: http://example.org/20OFF-1.html
// or use
get_item_link( 1 );
// return: http://example.org/20OFF-1.html
Example of using type “product” using return object:
$product_item = get_product_link( 1, true );
// print_r( $product_item );
Generate external using this function:
get_target_link( $type, $id );
Valid values for parameter $type:
- coupon
- product
- store
get_target_link( 'coupon', 1 );
// return: http://example.org/plugin/click/?coupon=1