Skip to content

Commit

Permalink
feat: add dokan_get_permalink function to retrieve dokan pages url (#517
Browse files Browse the repository at this point in the history
)

* feat: add dokan_get_permalink function to retrieve dokan pages url

* feat: add dokan_is_store_listing function
  • Loading branch information
saimonh3 authored and sabbir1991 committed Jan 10, 2019
1 parent 1f893c4 commit 2b1ddd4
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3351,3 +3351,43 @@ function dokan_get_variable_product_earning( $product_id, $seller_id, $formated

return $earning;
}

/**
* Get page permalink of dokan pages by page id
*
* @since DOKAN_SINCE
*
* @param string $page_id
*
* @return string
*/
function dokan_get_permalink( $page_id ) {
if ( ! $page_id ) {
return false;
}

$pages = get_option( 'dokan_pages' );

return isset( $pages[$page_id] ) ? get_permalink( $pages[$page_id] ) : false;
}

/**
* Check if it's store listing page
*
* @since DOKAN_SINCE
*
* @return boolean
*/
function dokan_is_store_listing() {
$page_id = dokan_get_option( 'store_listing', 'dokan_pages' );

if ( ! $page_id ) {
return false;
}

if ( $page_id === get_the_ID() ) {
return true;
}

return false;
}

0 comments on commit 2b1ddd4

Please sign in to comment.