Created
October 27, 2018 15:15
-
-
Save tareq1988/a01e0b64b1e49965600c8d2ceea71b13 to your computer and use it in GitHub Desktop.
Dokan seller info in popup on store page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_enqueue_scripts', function() { | |
if ( ! dokan_is_store_page() ) { | |
return; | |
} | |
wp_enqueue_style('dokan-magnific-popup'); | |
wp_enqueue_script('dokan-popup'); | |
} ); | |
add_action( 'dokan_store_header_info_fields', function( $vendor_id ) { | |
$bio = get_user_meta( $vendor_id, 'description', true ); | |
$more = ' <a href="#" id="vendor-bio-' . $vendor_id . '">(read more..)</a>'; | |
echo '<li>'; | |
echo wp_trim_words( $bio, 3, $more ); | |
echo '</li>'; | |
?> | |
<script> | |
jQuery(function($) { | |
$('#vendor-bio-<?php echo $vendor_id; ?>').magnificPopup({ | |
items: { | |
src: '<div class="white-popup" style="padding: 20px"><?php echo esc_js( $bio ); ?></div>', | |
type: 'inline' | |
} | |
}); | |
}) | |
</script> | |
<?php | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment