How to add custom badge to store-listing after vender name
✔ Recommended Answer
function display_author_name_store_listing() { if (!is_plugin_active('dokan-lite/dokan.php')) { return ""; } global $wpdb; $ubicon = $wpdb->prefix . 'ubicon'; //user badge verified users // Get the author ID (the vendor ID) $vendor_id = get_post_field('post_author', get_the_id()); $result = $wpdb->get_row($wpdb->prepare("SELECT * FROM $ubicon WHERE link_id = %d", $vendor_id)); $bage_url = $result->badge_url; return $bage_url;}add_action('dokan_store_list_loop_after_store_name', 'display_author_name_store_listing');
Source: stackoverflow.com
Answered By: mujuonly
To add a custom badge to a store-listing after the vendor name in PHP, you can follow these steps:
First, you need to identify the location in the code where the vendor name is displayed. This will depend on the specific platform or application you are using for your store-listing.
Once you have identified the location where the vendor name is displayed, you can add the custom badge by adding HTML code to the PHP code. For example, you can use the following HTML code to create a badge with a blue background and white text:
html<span style="background-color: blue; color: white; padding: 5px;">Custom Badge</span>
- To integrate this HTML code into your PHP code, you can use the following syntax:
phpecho '<span style="background-color: blue; color: white; padding: 5px;">Custom Badge</span>';
Replace "Custom Badge" with the text or image you want to use for your badge.
Save the changes to your PHP code and check the store-listing to ensure that the custom badge is displaying correctly after the vendor name.
Note that the specific steps and code required to add a custom badge to a store-listing in PHP will vary depending on the platform or application you are using.
Comments
Post a Comment