Skip to content

Instantly share code, notes, and snippets.

View robertdevore's full-sized avatar
🐺
#LoneWolfLifestyle

Robert DeVore robertdevore

🐺
#LoneWolfLifestyle
View GitHub Profile
<?php
add_filter( 'fg_easypassthrough_populate_same_form', '__return_false' );
/**
* 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();
@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']
<?php
foreach ( $flowers as $flower=>$value ) {
$_data['categories'][$value->term_id] = $value->name;
}
@robertdevore
robertdevore / wpd-rest-api-flowers-category.php
Created May 19, 2018 19:53
The current way WP Dispensary adds in the custom flowers_category taxonomy to the Flowers REST API endpoint
<?php
/**
* Add Category taxonomy for the Flowers Custom Post Type
*/
function flowers_category( $data, $post, $request ) {
$_data = $data->data;
$_data['flowers_category'] = get_the_term_list( $post->ID, 'flowers_category', '', ' ', '' );
$data->data = $_data;
return $data;
}
@robertdevore
robertdevore / pmpro-limit-available-plugins-and-themes.php
Created May 17, 2018 00:03 — forked from strangerstudios/pmpro-limit-available-plugins-and-themes.php
Limit the available plugins and themes for networks sites in a WordPress multisite install using Paid Memberships Pro.
<?php
/*
Plugin Name: PMPro Limit Available Plugins and Themes
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-limit-available-plugins/
Description: Limits Which Plugins are Available for Network Sites
Version: .1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
1. Place this file in wp-content/mu-plugins.
jQuery(function ($) {
$(".price-dropdown").hover(
function () {
$(this).addClass('display-block');
},
function () {
$(this).removeClass('display-block');
}
);
});
@robertdevore
robertdevore / woocommerce-publish-product-action-hook.php
Created May 10, 2018 16:06
Do something when a product is published in WooCommerce
<?php
/**
* @snippet Do Something When Product is Published
* @how-to Watch tutorial @ https://businessbloomer.com/?p=19055
* @sourcecode https://businessbloomer.com/?p=543
* @author Rodolfo Melogli
* @testedwith WooCommerce 3.2.6
*/
function add_this_to_new_products( $new_status, $old_status, $post ) {
@robertdevore
robertdevore / wordpress-all-pages-array.php
Last active May 9, 2018 19:20
Create array of all pages in WordPress.
<?php
// Get loop of all Pages.
$args = array(
'sort_column' => 'post_title',
'hierarchical' => 1,
'post_type' => 'page',
'post_status' => 'publish'
);
$pages = get_pages( $args );
<?php
$current_user = wp_get_current_user();
$billing_postcode = get_user_meta( $current_user->ID, 'billing_postcode', true );