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
| /** | |
| * Each of these samples can be used - note that you should pick one rather than add them all. | |
| * | |
| * How to use WC notices: https://github.com/woothemes/woocommerce/blob/master/includes/wc-notice-functions.php#L96 | |
| * Tutorial: http://www.skyverge.com/blog/edit-woocommerce-templates/ | |
| **/ | |
| /** | |
| * Add a content block after all notices, such as the login and coupon notices. | |
| * |
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 | |
| // UPDATE: Stefan from Stack Overflow has explained a better way to handle cart item data. | |
| // See http://stackoverflow.com/a/32327810/470480 | |
| // ---------------------- | |
| /* | |
| Instructions: |
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 | |
| # http://kovshenin.com/2012/the-wordpress-settings-api/ | |
| # http://codex.wordpress.org/Settings_API | |
| add_action( 'admin_menu', 'my_admin_menu' ); | |
| function my_admin_menu() { | |
| add_options_page( __('My Plugin Options', 'textdomain' ), __('My Plugin Options', 'textdomain' ), 'manage_options', 'my-plugin', 'my_options_page' ); | |
| } | |
| add_action( 'admin_init', 'my_admin_init' ); |
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 | |
| $args = array( | |
| 'post_author' => 1, | |
| 'post_content' => '', | |
| 'post_status' => "draft", // (Draft | Pending | Publish) | |
| 'post_title' => '', | |
| 'post_parent' => '', | |
| 'post_type' => "product" | |
| ); |
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 | |
| /** | |
| * Create the image attachment and return the new media upload id. | |
| * | |
| * @author Joshua David Nelson, josh@joshuadnelson.com | |
| * | |
| * @since 03.29.2017 updated to a class, utilizing code from Takuro Hishikawa's gist linked below. | |
| * | |
| * @see https://gist.github.com/hissy/7352933 | |
| * |
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 /* 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'); |
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 | |
| /* | |
| Plugin Name: Woocommerce Bookings Dropdown | |
| Description: Swaps the date picker for a dropdown of dates | |
| Version: 1.0.0 | |
| Author: Webby Scots | |
| Author URI: http://webbyscots.com/ | |
| */ | |
| $wswp_dates_built = false; | |
| add_filter('booking_form_fields','wswp_booking_form_fields'); |
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 Bookings Availability Search | |
| * | |
| * This is almost pseudo code, it only serves to explain the "how to do it" and does not attempt to be "The Way" to do it. | |
| * NOTE: This NEEDS to be refined in order to work as expected. | |
| * | |
| * @author António Pinto <apinto@vanguardly.com> | |
| * @license http://opensource.org/licenses/gpl-license.php GNU Public License | |
| * |
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
| //WP Query to get all bookable products of a vendor | |
| $args = array( | |
| 'post_type' => 'product', | |
| 'author' => $vendor, | |
| 'meta_query' => array( | |
| array( | |
| 'key' => '_wc_booking_availability', | |
| 'compare' => 'EXISTS', | |
| ), |
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 | |
| #API access key from Google API's Console | |
| define( 'API_ACCESS_KEY', 'YOUR-SERVER-API-ACCESS-KEY-GOES-HERE' ); | |
| $registrationIds = $_GET['id']; | |
| #prep the bundle | |
| $msg = array | |
| ( | |
| 'body' => 'Body Of Notification', |