docan vendor biography

Home » Snippets » docan vendor biography
0

Created with:

Visibility: 

public

Creator: Abdelraouf

Customize with WPTurbo AI
X

Add Snippet To Project

New Project
Add To Existing Project
					<?php
function wpturbo_dokan_vendor_bio_shortcode( $atts, $content = null ) {
    $atts = shortcode_atts( array(
        'store_id' => '',
    ), $atts );

    // Make sure the Dokan plugin is active
    if ( ! class_exists( 'WeDevs_Dokan' ) ) {
        return esc_html__( 'Dokan plugin is not active.', 'wpturbo' );
    }

    // Get vendor information
    $vendor_info = dokan()->vendor->get( absint( $atts['store_id'] ) );

    if ( ! $vendor_info ) {
        return esc_html__( 'Vendor does not exist.', 'wpturbo' );
    }

    // Get the vendor bio
    $vendor_bio = $vendor_info->get_bio();

    // Sanitize vendor bio
    $vendor_bio = wp_kses_post( $vendor_bio );

    // Return the vendor bio
    return '<div class="dokan-vendor-bio">' . $vendor_bio . '</div>';
}
add_shortcode( 'dokan_vendor_bio', 'wpturbo_dokan_vendor_bio_shortcode' );
				

dokan vendor biography shortcode

Register an account to save your snippets or go Pro to get more features.