-
-
Save mmarj/63721c6b2c63ff0277ed2748725fab16 to your computer and use it in GitHub Desktop.
Dokan seller info in popup on store page
This file contains hidden or 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