Implementation of the SOAP server - server.php:
<?php
// turn off WSDL caching
ini_set("soap.wsdl_cache_enabled","0");
// model, which uses in web service functions as parameter| //Hi, i created a function for adding variable products based on your code. I share it here in case anyone needs it: | |
| //The first parameter is the title of the product, $cats is the products category id which has to be an array and must be created previously, $variations is an array which contains the variations with prices, descriptions, discount, and $variations_key is the key of the parent attribute which has to be created previously on teh attributes page. | |
| //I´m creating a ticket´s selling store and I´m using 2 globals: $logger and $vgh from my framework, please ignore them. | |
| <? | |
| function create_variable_woo_product($title, $cats = array(), $variations, $variations_key) { | |
| global $wpdb, $logger, $vgh; |
| <?php | |
| namespace App\Events; | |
| use Illuminate\Contracts\Broadcasting\ShouldBroadcast; | |
| use Illuminate\Queue\SerializesModels; | |
| class NewMessage extends Event implements ShouldBroadcast | |
| { | |
| <?php | |
| global $acf_recalc_settings; | |
| // IMPORTANT: Customize these settings for your website. | |
| $acf_recalc_settings = array( | |
| // How many updates to do each page load. As of November 2018, Google's GeoLocation API limit is 100 per second. | |
| 'posts_per_run' => 16, | |
| <?php | |
| /** | |
| * Example programmatic registration of Advanced Custom Fields fields | |
| * | |
| * @see http://www.advancedcustomfields.com/resources/register-fields-via-php/ | |
| */ | |
| function register_custom_acf_fields() { | |
| if ( function_exists( 'acf_add_local_field_group' ) ) { |
| <?php | |
| /** | |
| * Get field key for field name. | |
| * Will return first matched acf field key for a give field name. | |
| * | |
| * ACF somehow requires a field key, where a sane developer would prefer a human readable field name. | |
| * http://www.advancedcustomfields.com/resources/update_field/#field_key-vs%20field_name | |
| * | |
| * This function will return the field_key of a certain field. |
| SELECT product.ID as product_id, product.post_title as product_name, replace(product.post_content, '"', "'") as product_content, product_sku.meta_value as product_sku, product_price.meta_value as product_price, product_weight.meta_value as product_weight | |
| FROM wp_posts as product | |
| LEFT JOIN wp_postmeta as product_sku ON product.ID = product_sku.post_ID | |
| LEFT JOIN wp_postmeta as product_price ON product.ID = product_price.post_ID | |
| LEFT JOIN wp_postmeta as product_weight ON product.ID = product_weight.post_ID | |
| WHERE (product.post_type = 'product' OR product.post_type = 'product_variation') AND product_sku.meta_key = '_sku' AND product_price.meta_key = '_price' AND product_weight.meta_key = '_weight' | |
| ORDER BY product_id ASC |
| <?php | |
| /** | |
| * Plugin Name: WooCommerce - List Products by Tags | |
| * Plugin URI: http://www.remicorson.com/list-woocommerce-products-by-tags/ | |
| * Description: List WooCommerce products by tags using a shortcode, ex: [woo_products_by_tags tags="shoes,socks"] | |
| * Version: 1.0 | |
| * Author: Remi Corson | |
| * Author URI: http://remicorson.com | |
| * Requires at least: 3.5 | |
| * Tested up to: 3.5 |
| <?php /* This function attaches the image to the post in the database, add it to functions.php */ | |
| function insert_attachment($file_handler,$post_id,$setthumb='false') { | |
| // check to make sure its a successful upload | |
| if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK) __return_false(); | |
| require_once(ABSPATH . "wp-admin" . '/includes/image.php'); | |
| require_once(ABSPATH . "wp-admin" . '/includes/file.php'); | |
| require_once(ABSPATH . "wp-admin" . '/includes/media.php'); |