Skip to content

Instantly share code, notes, and snippets.

Gareth Harris plugin-republic

Block or report user

Report or block plugin-republic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View pewc_product_extra_fields.php
<?php
/**
* Display add-on fields on products that do not have a price
*/
add_action( 'woocommerce_single_product_summary', 'pewc_product_extra_fields' );
View ie11_tab_hack.css
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
.pewc-tab {
display: none;
}
.pewc-groups-tabs .pewc-group-wrap {
display: block !important;
}
.pewc-radio-image-wrapper label input,
.pewc-checkbox-image-wrapper label input {
visibility: visible;
View add_weight_product_addon.php
/**
* Add title to radio and select options
*/
function prefix_add_option_param_titles( $group_id, $item_key, $item ) {
?>
<style type="text/css">
.pewc-option-option,
.pewc-option-price,
.pewc-option-extra {
width: 30%;
@plugin-republic
plugin-republic / allow-pdf-product-extras.php
Last active Nov 7, 2019
Allow the user to upload PDFs with the upload field
View allow-pdf-product-extras.php
<?php
// Add PDFs to list of permitted mime types
function my_prefix_pewc_get_permitted_mimes( $permitted_mimes ) {
// Add PDF to the list of permitted mime types
$permitted_mimes['pdf'] = "application/pdf";
// Remove a mime type - uncomment the line below if you wish to prevent JPGs from being uploaded
// unset( $permitted_mimes['jpg|jpeg|jpe'] );
return $permitted_mimes;
}
add_filter( 'pewc_permitted_mimes', 'my_prefix_pewc_get_permitted_mimes' );
View pewc_filter_settings.php
<?php
/**
* Add new options to the global Product Add-Ons Ultimate settings
*/
function prefix_filter_settings( $settings ) {
$settings['prefix_section_title'] = array(
'name' => __( 'New Title', 'pewc' ),
'type' => 'title',
'desc' => '',
'id' => 'prefix_section_title'
View wcfad_search_products_method.php
<?php
/**
* Include variations in products rule
*/
function prefix_search_products_method( $method, $args ) {
return 'woocommerce_json_search_products_and_variations';
}
add_filter( 'wcfad_search_products_method', 'prefix_search_products_method', 10, 2 );
View get-user-roles.php
<?php
/**
* Get the user's roles
* @since 1.0.0
*/
function wcmo_get_current_user_roles() {
if( is_user_logged_in() ) {
$user = wp_get_current_user();
$roles = ( array ) $user->roles;
return $roles; // This returns an array
View pewc_number_field_step_decimals.php
<?php
/**
* Filter the step parameter in Number fields to return decimals
*/
function prefix_number_field_step( $step, $item ) {
return 0.01;
}
add_filter( 'pewc_number_field_step', 'prefix_number_field_step', 10, 2 );
View pewc_filter_view_product_text
<?php
/**
* Filter 'View Product' text
*/
function prefix_filter_view_product_text( $text, $product ) {
return 'Select Options';
}
add_filter( 'pewc_filter_view_product_text', 'prefix_filter_view_product_text', 10, 2 );
View pewc_enable_ajax_load_addons.php
<?php
/**
* Use AJAX to load add-ons on product edit screens
*/
add_filter( 'pewc_enable_ajax_load_addons', '__return_true' );
You can’t perform that action at this time.