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 | |
/* | |
* | |
* Add new WooCommerce account menu item for a specific members role | |
* | |
* */ | |
add_filter ( 'woocommerce_account_menu_items', 'ns_members_link', 40 ); | |
function ns_members_link( $menu_links ){ | |
$product_ids = array( 38, 41, 85, 95 ); |
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 | |
/* | |
* | |
* Add new role for specific product when order is completed WooCommerce | |
* | |
* */ | |
add_action( 'woocommerce_order_status_completed', 'ns_change_role_on_purchase' ); | |
function ns_change_role_on_purchase( $order_id ) { | |
// get order object and items |
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 | |
/* | |
* | |
* Force registering when buying specific products on WooCommerce | |
* | |
* */ | |
add_action( 'woocommerce_after_checkout_validation' , 'ns_restict_registration_for_some_products', 10, 2 ); | |
function ns_restict_registration_for_some_products( $data, $errors ) { | |
if( isset( $data['createaccount'] ) && !$data['createaccount'] ) { |
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
/** | |
* | |
* https://codex.wordpress.org/Post_Status_Transitions | |
* | |
* Send email to admin after user create new product from frontend form. | |
* Send emails on products publication | |
* @param WP_Post $post | |
* | |
* | |
*/ |
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_type' => 'projects', | |
'posts_per_page' => 9, | |
'post_status' => 'publish', | |
'meta_query' => array( | |
'relation' => 'OR', | |
array( | |
'key' => 'featured-checkbox', |
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 | |
/* Gravity Forms Word Count Script */ | |
function els_load_scripts() { | |
wp_enqueue_script('gravity-forms-word-count', get_stylesheet_directory_uri() . '/js/jquery.gravity_word_count.js', array('jquery'), '0.1', true); | |
} | |
add_action('wp_enqueue_scripts', 'els_load_scripts'); | |
/*Then in the form, for fields that need the word count, add the class ‘els-word-count[300].' Change [300] as needed for the maximum words that can be added to that particular field.*/ | |
/*Source http://www.gravityhelp.com/forums/topic/maximum-word-count#post-149331*/ |
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
npm install --save asset-builder browser-sync del gulp gulp-autoprefixer gulp-changed gulp-concat gulp-cssnano gulp-flatten gulp-if gulp-imagemin gulp-jshint gulp-less gulp-plumber gulp-rename gulp-rev gulp-sass gulp-sourcemaps gulp-uglify imagemin-pngcrush jshint jshint-stylish lazypipe merge-stream minimist run-sequence traverse wiredep gulp-util gulp-combine-mq critical gulp-rename gulp-penthouse |
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
/*! | |
* gulp | |
* $ npm install gulp-ruby-sass gulp-autoprefixer gulp-cssnano gulp-jshint gulp-concat gulp-uglify gulp-imagemin gulp-notify gulp-rename gulp-livereload gulp-cache del --save-dev | |
*/ | |
// Load plugins | |
var gulp = require('gulp'), | |
sass = require('gulp-ruby-sass'), | |
autoprefixer = require('gulp-autoprefixer'), | |
cssnano = require('gulp-cssnano'), |
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 | |
/** | |
* How To Disable Admin Notices In WordPress | |
* | |
*/ | |
add_action('admin_enqueue_scripts', 'os_admin_theme_style'); | |
add_action('login_enqueue_scripts', 'os_admin_theme_style'); | |
function os_admin_theme_style() { | |
$super_admins = array( 5 ); | |
if( ! in_array( get_current_user_id(), $super_admins ) ){ |
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
/** | |
* | |
* Shortcode contact form | |
*/ | |
// @codingStandardsIgnoreStart | |
function decorativefair_shortcode_product_form($item) { | |
ob_start(); | |
global $post, $product; | |
$author_name = get_the_author_meta( 'user_email', $product->post->post_author ); |