Skip to content

Instantly share code, notes, and snippets.

@nayemDevs
nayemDevs / functions.php
Last active January 29, 2024 08:39
Creating a shortcode to show vendor biography anywhere on your page
<?php
/**
* Plugin Name: Dokan Vendor Biography Shortcode
*/
add_shortcode( 'dokan_vendor_bio', 'dokan_vendor_bio_shortcode' );
function dokan_vendor_bio_shortcode() {
$vendor = dokan()->vendor->get( get_query_var( 'author' ) );
$store_info = $vendor->get_shop_info();
if ( empty( $store_info['vendor_biography'] ) ) {
return;
@nayemDevs
nayemDevs / functions.php
Last active July 28, 2022 11:27
Show store name on single product page (Sold by: vendor) when you have created single product via Elementor
/**
* Show sold by on single product page made with Elementor
* Add the shortcode [dokan_vendor_name] through a short-code widget on single product page
*/
add_shortcode( 'dokan_vendor_name', 'dokan_store_name_shortcode' );
function dokan_store_name_shortcode() {
$seller = get_post_field( 'post_author' );
$author = get_user_by( 'id', $seller );
$vendor = dokan()->vendor->get( $seller );