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 a 'Add rel="nofollow" to link' checkbox to the WordPress link editor | |
* | |
* @see https://danielbachhuber.com/tip/rel-nofollow-link-modal/ | |
*/ | |
add_action( 'after_wp_tiny_mce', function(){ | |
?> | |
<script> |
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
#!/bin/bash | |
# Help / usage info. | |
USAGE=$'WordPress Helper script, built for EasyEngine but should be widely compatible.\nWithout any args it will search /var/www/ for WordPress sites, loop over them in alphabetical order and check for core and plugin updates.\nAlso accepts:\n\t--sites=[space seperated list of site paths relative to /var/www]\n\t--update=[plugins|wp|all].' | |
# Die function for exiting on errors. | |
die () { | |
echo "${1}, exitting..." >&2 ; echo ; exit 1 | |
} |
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
To require, or not to require, that is the question...... In the future, we'll make these into checkboxes to require/not require, | |
but for now you use filters. Add this code to your themes functions.php file. Here's the process: | |
1.) Find the filter for the field you want to adjust the requirements. This file is in /plugins/wc-vendors-pro/public/forms/class-wcvendors-pro-product-form.php | |
2.) Create a filter for each field you'd like to make required (or not required). The code below will make the description required: | |
/* WC Vendors Pro - Make Description Required */ | |
function wcv_product_description_required( $args ) { | |
$args[ 'custom_attributes' ] = array( |
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
/* WC Vendors Pro - Notify Vendor when Product is Approved */ | |
add_action( 'pending_to_publish', 'wcv_notify_vendor_on_publish' ); | |
function wcv_notify_vendor_on_publish( $post_id ) { | |
global $post; | |
if ( $post->post_author != get_current_user_id() ) { | |
$author = new WP_User( $post->post_author ); | |
$email_data = array( | |
'to' => $author->user_email, | |
'subject' => sprintf( __( 'Your post on %1$s has been published!', 'email_author_on_publish' ), get_bloginfo('name') ), | |
'message' => sprintf( __( 'Your post "%1$s" on %2$s has been published: %3$s', 'email_author_on_publish' ), $post->post_title, get_bloginfo( 'name' ), get_permalink( $post->ID ) ), |
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 | |
/** | |
* Example text input with validation | |
*/ | |
WCVendors_Pro_Form_Helper::input( | |
array( | |
'post_id' => $object_id, | |
'id' => '_wcv_custom_product_example_text_input', | |
'label' => __( 'Product Meta Text Input', 'wcvendors-pro' ), |
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
/* BEGIN REGISTRATION FIELDS */ | |
function cs_wc_extra_register_fields() { | |
?> | |
<p class="form-row form-row-first"> | |
<label for="reg_billing_first_name"><?php _e( 'First Name', 'textdomain' ); ?> <span class="required">*</span></label> | |
<input type="text" class="input-text" name="billing_first_name" id="reg_billing_first_name" value="<?php if ( ! empty( $_POST['billing_first_name'] ) ) esc_attr_e( $_POST['billing_first_name'] ); ?>" /> | |
</p> | |
<p class="form-row form-row-last"> | |
<label for="reg_billing_last_name"><?php _e( 'Last Name', 'textdomain' ); ?> <span class="required">*</span></label> | |
<input type="text" class="input-text" name="billing_last_name" id="reg_billing_last_name" value="<?php if ( ! empty( $_POST['billing_last_name'] ) ) esc_attr_e( $_POST['billing_last_name'] ); ?>" /> |
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
// Place this in your themes functions.php | |
// This will put the menu item in your primary menu. Change the theme location if you want to change which menu this goes in. | |
// Use the Free code for WC Vendors Free, use the Pro code for WC Vendors Pro | |
/* BEGIN WC Vendors Free */ | |
add_filter( 'wp_nav_menu_items', 'wcv_vendors_menu', 10, 2 ); | |
function wcv_vendors_menu ( $items, $args ) { | |
if ($args->theme_location == 'primary') { | |
$vendors = get_users( array( 'role' => 'vendor' ) ); | |
$items .= '<li><a href="#">Vendors</a>'; |
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
{ | |
"payZen": { | |
"url": "https://secure.payzen.eu/vads-payment/", | |
"certificat": "XXXXXXXXX", | |
"vads_site_id": "YYYYYYYY", | |
"vads_version": "V2", | |
"vads_ctx_mode": "TEST" | |
} | |
} |
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 ACF setting page under Events CPT menu | |
* | |
* @since 1.0.0 | |
*/ | |
if ( function_exists( 'acf_add_options_sub_page' ) ){ | |
acf_add_options_sub_page(array( | |
'title' => 'Event Settings', | |
'parent' => 'edit.php?post_type=events', |
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_action( 'wp_enqueue_scripts', 'enqueue_my_styles' ); | |
/** | |
* Example callback function that demonstrates how to properly enqueue conditional stylesheets in WordPress for IE. | |
* IE10 and up does not support conditional comments in standards mode. | |
* | |
* @uses wp_style_add_data() WordPress function to add the conditional data. | |
* @link https://developer.wordpress.org/reference/functions/wp_style_add_data/ |
NewerOlder