Hi,
I am trying to create a slider that loop through users with the role of vendors, I am using a third party plugin for the vendors, and I registered all the user custom fields with types, as in the picture, except I am trying to create a link to the vendors page.
I added the following wp-config :
// get the store url
function get_store_url(){
global $authordata;
$store_info = dokan_get_store_info( $authordata->ID );
if ( !empty( $store_info['store_name'] ) ) {
$vendor_link = dokan_get_store_url( $authordata->ID );
return $vendor_link;
}
}
and from the toolset setting I registered the short code, and added the short code in the slider, the slider is working except all the links direct to the admin store page.
I need each link to direct to the current vendor in the slider loop.
any help is appreciated
thanks
I managed to solve this issue, I hope this could help someone else later:
in child theme function.php add the short-code that takes id=" " as an attribute :
function get_store_url($atts){
$a = shortcode_atts(
array(
'id' => '1',
),
$atts );
$seller_id = get_user_by( 'id', $a['id'] );
$vendor = dokan()->vendor->get( $seller_id );
return $vendor->get_shop_url();
}
add_shortcode( 'store_vendor_url', 'get_store_url' );
then from toolset> settings>front-end content>3rd party shortcode add :
in the slider or any view you may use :
[store_vendor_url id="5"]
for vendor with id 5
or for the current vendor in the slider loop:
[store_vendor_url id="[wpv-user field='ID']"]
or
<a class="btn btn-primary" target="_blank" href="[store_vendor_url id="[wpv-user field='ID']"]"> Visit Store </a> </div>
(quotation format is really important otherwise won't work)
thanks