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 | |
/** | |
* Prevent a field from being rendered | |
* Filter : https://www.advancedcustomfields.com/resources/acf-prepare_field/ | |
* | |
*/ | |
function hide_acf_field_on_admin( $field ) { | |
// Don't show this field if it contains a value. | |
if ( $field['value'] ) { |
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_shortcode( 'dokan_vendor_dashbord', 'dokan_show_vendor_dashboard_url' ); | |
function dokan_show_vendor_dashboard_url() { | |
if ( ! dokan_is_user_seller( get_current_user_id() ) ) { | |
return; | |
} | |
printf( | |
'<p><a href="%s" class="dokan-btn dokan-btn-theme vendor-dashboard" >%s</a></p>', |
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
Add the following piece of code to your functions.php file. | |
add_shortcode('getMembership-lists', 'ajax_membership_table_shortcode'); | |
// WITH AJAX LOAD TABLE | |
function membership_datatables_scripts() { | |
wp_register_style('datatables_style', '//cdn.datatables.net/1.11.1/css/jquery.dataTables.min.css'); | |
wp_enqueue_style('datatables_style'); |
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 //No copiar esta línea | |
// Filtro para agregar contenido a una página de WordPress | |
add_filter('the_content', 'dcms_add_custom_content'); | |
// Agregamos contenido sólo a la página con el título "Contenido Vinos" | |
function dcms_add_custom_content($content){ | |
if ( ! is_page('contenido-vinos') ) return $content; |
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( 'woocommerce_before_single_product', 'bbloomer_show_video_not_image' ); | |
function bbloomer_show_video_not_image() { | |
// Do this for product ID = 282 only | |
if ( is_single( '282' ) ) { | |
remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 ); | |
remove_action( 'woocommerce_product_thumbnails', 'woocommerce_show_product_thumbnails', 20 ); |
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
/** | |
* Hide shipping rates when free shipping is available. | |
* | |
* @param array $rates Array of rates found for the package. | |
* @return array | |
*/ | |
function dokan_vendor_shipping_hide_when_free_is_available( $rates ) { | |
$free = array(); | |
foreach ( $rates as $rate_id => $rate ) { |
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
<? // no copiar esta línea | |
add_filter( 'the_content', 'dcms_list_data' ); | |
function dcms_list_data( $content ) { | |
$database_name = 'employees'; // nombre de la base de datos | |
$database_user = 'root'; | |
$database_pass = 'root'; | |
$database_server = 'localhost'; |
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 | |
/** | |
* WooCommerce Extra Feature | |
* -------------------------- | |
* | |
* Add custom fee to cart automatically | |
* | |
*/ | |
function woo_add_cart_fee() { | |
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
/** | |
* Validation add for product cover image | |
* | |
* @param array $errors | |
* @return array $errors | |
*/ | |
function dokan_can_add_product_validation_customized( $errors ) { | |
$postdata = wp_unslash( $_POST ); | |
$featured_image = absint( sanitize_text_field( $postdata['feat_image_id'] ) ); | |
$_regular_price = absint( sanitize_text_field( $postdata['_regular_price'] ) ); |
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
function dokan_custom_seller_registration_required_fields( $required_fields ) { | |
$required_fields['gst_id'] = __( 'Please enter your GST number', 'dokan-custom' ); | |
return $required_fields; | |
}; | |
add_filter( 'dokan_seller_registration_required_fields', 'dokan_custom_seller_registration_required_fields' ); |
NewerOlder