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
add_action( 'woocommerce_product_after_variable_attributes','variation_settings_fields', 10, 3 ); | |
// Save Variation Settings | |
add_action( 'woocommerce_save_product_variation', 'save_variation_settings_fields', 10, 2 ); | |
/** | |
* Create new fields for variations | |
* | |
*/ | |
function variation_settings_fields( $loop, $variation_data, $variation ) { | |
// Text Field | |
woocommerce_wp_text_input( |
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
add_action('pre_get_posts', 'um_filter_media_files'); | |
add_filter('wp_count_attachments', 'um_recount_attachments'); | |
function um_recount_attachments($counts_in){ | |
global $wpdb; | |
global $current_user; | |
$and = wp_post_mime_type_where(''); // Default mime type // AND post_author = {$current_user->ID} |
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 | |
// Inside MyApp/ create composer.json with the below contents | |
{ | |
"require": { | |
}, | |
"autoload": { | |
"psr-4": { | |
"MyApp\\": ["src/", "tests/"] | |
} | |
} |
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
function azweb_marketplace_wc_create_page( $slug, $option = '', $page_title = '', $page_content = '', $post_parent = 0 ) { | |
global $wpdb; | |
$option_value = get_option( $option ); | |
if ( $option_value > 0 ) { | |
$page_object = get_post( $option_value ); | |
if ( 'page' === $page_object->post_type && ! in_array( $page_object->post_status, array( 'pending', 'trash', 'future', 'auto-draft' ) ) ) { | |
return $page_object->ID; |
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
function my_custom_text_strings( $translated_text, $text, $domain ) { | |
switch ( $translated_text ) { | |
case 'Show all product types' : | |
$translated_text = __( 'Show all solutions types', 'woocommerce' ); | |
break; | |
case 'Sort Products' : | |
$translated_text = __( 'Show Solutions', 'woocommerce' ); | |
break; | |
case 'Product Data' : | |
$translated_text = __( 'Solutions Data', 'woocommerce' ); |
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
add_filter('manage_inquiry_posts_columns', 'custom_table_head'); | |
function custom_table_head( $defaults ) { | |
$defaults['author'] = 'Inquiry By'; | |
$defaults['date'] = 'Created Date'; | |
return $defaults; | |
} |
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
add_filter( 'post_updated_messages', 'update_new_messages' ,100); | |
function update_new_messages( $messages ) { | |
$post = get_post(); | |
$post_type = get_post_type( $post ); | |
$post_type_object = get_post_type_object( $post_type ); | |
if($post_type != 'product') | |
return; |
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_filter( 'woocommerce_product_data_tabs', 'add_my_custom_product_data_tab' , 99 , 1 ); | |
function add_my_custom_product_data_tab( $product_data_tabs ) { | |
/* | |
to remove this product type unset all product type | |
unset($product_data_tabs['general']); | |
unset($product_data_tabs['inventory']); | |
unset($product_data_tabs['shipping']); | |
unset($product_data_tabs['linked_product']); |
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
1. load media in controller / function.php / plugins | |
``` | |
function enqueue_media_scripts() { | |
if(function_exists('wp_enqueue_media')) { | |
wp_enqueue_media(); | |
} | |
else { | |
wp_enqueue_script('media-upload'); | |
wp_enqueue_script('thickbox'); |