Skip to content

Instantly share code, notes, and snippets.

View robertdevore's full-sized avatar
🛠️
#NeverNotWorking

Robert DeVore robertdevore

🛠️
#NeverNotWorking
View GitHub Profile
<?php
foreach ( $flowers as $flower=>$value ) {
$_data['categories'][$value->term_id] = $value->name;
}
@robertdevore
robertdevore / post-process.php
Created August 10, 2018 14:31 — forked from bueltge/post-process.php
WordPress Custom Post Type: Insert post via Frontend
<?php
/**
* post-process.php
* make sure to include post-process.php in your functions.php. Use this in functions.php:
*
* get_template_part('post-process');
*
*/
function do_insert() {
if( 'POST' == $_SERVER['REQUEST_METHOD']
/**
* Custom account fields
*/
add_action( 'woocommerce_edit_account_form', 'my_woocommerce_edit_account_form' );
add_action( 'woocommerce_save_account_details', 'my_woocommerce_save_account_details' );
function my_woocommerce_edit_account_form() {
$user_id = get_current_user_id();
<?php
add_filter( 'fg_easypassthrough_populate_same_form', '__return_false' );
@robertdevore
robertdevore / ddwc-driver-application-filter.php
Created January 14, 2019 20:24
Filter the text displayed for the "apply to become a driver" page
<?php
/**
* Driver Dadshboard - Access Denied Filter
*/
function acme_access_denied( $access_denied ) {
if ( false !== get_option( 'ddwc_pro_settings_driver_application' ) && 'yes' == get_option( 'ddwc_pro_settings_driver_application' ) ) {
if ( false !== get_option( 'ddwc_pro_settings_contact_page' ) && 'none' !== get_option( 'ddwc_pro_settings_contact_page' ) ) {
$contact_link = get_permalink( get_option( 'ddwc_pro_settings_contact_page' ) );
} else {
$contact_link = 'mailto:' . get_option( 'admin_email' );
@robertdevore
robertdevore / woocommerce-custom-shipping-method.php
Created March 3, 2019 18:46 — forked from malkafly/woocommerce-custom-shipping-method.php
Adding custom shipping method for WooCommerce (v. 3.2.6)
<?php
//Works with WooCommerce 3.2.6
add_action( 'woocommerce_shipping_init', 'econt_shipping_method' );
function econt_shipping_method() {
if ( ! class_exists( 'WC_Econt_Shipping_Method' ) ) {
class WC_Econt_Shipping_Method extends WC_Shipping_Method {
public function __construct( $instance_id = 0 ) {
$this->instance_id = absint( $instance_id );
$this->id = 'econt';//this is the id of our shipping method
@robertdevore
robertdevore / woocommerce-add-product-to-order.php
Last active May 27, 2019 23:47
Add a product to an order in WooCommerce programatically
<?php
// Get order data.
$order = wc_get_order( 1246 );
// Order total.
$total = $order->get_total();
// Add Product data.
$product_id = 8;
$quantity = 1;
<?php
/**
* Filters the link text of the header logo above the login form.
*
* @since 5.2.0
*
* @param string $login_header_text The login header logo link text.
*/
$login_header_text = apply_filters( 'login_headertext', $login_header_text );
@robertdevore
robertdevore / ddwc-unclaimed-orders-my-account-menu-link.php
Last active July 22, 2019 22:36
Add unclaimed orders link to WooCommerce My Account menu items
@robertdevore
robertdevore / remove-details-from-ddwc-dashboard.php
Created July 24, 2019 16:38
Remove specific order details from the Driver Dashboard
<?php
/**
* Remove data from order details
*/
add_filter( 'ddwc_driver_dashboard_delivery_total', '__return_false' );
add_filter( 'ddwc_driver_dashboard_order_total', '__return_false' );
add_filter( 'ddwc_driver_dashboard_total_title', '__return_false' );
add_filter( 'ddwc_driver_dashboard_order_item_price', '__return_false' );
add_filter( 'ddwc_driver_dashboard_payment_method', '__return_false' );
add_filter( 'ddwc_driver_dashboard_assigned_orders_total_title', '__return_false' );