One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
<?php | |
/** | |
* Retrieves a custom field value using Advanced Custom Fields (ACF) plugin. | |
* | |
* @param string $field_name The name of the ACF field. | |
* @param array $options Optional. An array of options to pass to the `get_field()` function. Default is an empty array. | |
* @return mixed The value of the ACF field, or an empty string if ACF plugin is disabled. | |
*/ | |
function custom_get_acf_field($field_name, $options = '') { | |
if ( function_exists('get_field') ) { |
<?php | |
add_filter( 'wpseo_breadcrumb_links', 'override_yoast_breadcrumb_links' ); | |
function override_yoast_breadcrumb_links( $links ) { | |
global $post; | |
if ( is_singular( 'post' ) ) { | |
$breadcrumb[] = array( | |
'url' => get_permalink( get_option( 'page_for_posts' ) ), | |
'text' => 'Blog', |
<?php | |
add_action('wp_head' , 'remove_cc_information'); | |
function remove_cc_information() { | |
global $wpdb; | |
$db_table_name = $wpdb->prefix . 'frm_item_metas'; | |
$results = $wpdb->get_results("SELECT id, meta_value FROM {$db_table_name} WHERE field_id = '83'", ARRAY_A); | |
// Loops through and unserializes data to strip out CC/CVC numbers then updates the DB | |
foreach ( $results as $result) { |
<?php | |
// Elevate caps since theme options are required to access widgets | |
$role = get_role('shop_manager'); | |
$role->add_cap('edit_theme_options'); | |
// Allow Editor widget access but remove themes, menu options and customizer. | |
function custom_admin_menu() { | |
$user = new WP_User(get_current_user_id()); |
<?php | |
function add_this_to_new_products( $product_get_id ) { | |
$productType = WC_Product_Factory::get_product_type( $product_get_id); | |
if( $productType == 'registrations') { | |
update_post_meta( $product_get_id, '_tax_status', 'none' ); | |
} | |
} |
<?php | |
function deleteProduct($id, $force = FALSE) { | |
$product = wc_get_product($id); | |
if(empty($product)) | |
return new WP_Error(999, sprintf(__('No %s is associated with #%d', 'woocommerce'), 'product', $id)); | |
// If we're forcing, then delete permanently. | |
if ($force) { | |
if ($product->is_type('variable')) { |
<?php | |
function delete_variations(){ | |
// Lets grab the product type | |
$product_id = get_the_ID(); | |
$product_type = WC_Product_Factory::get_product_type( $product_id ); | |
// Lets skip everything if its not a product. | |
if( $product_type == false ) return; | |
// Lets make sure we are working with registrations |
<?php | |
add_filter('woocommerce_dropdown_variation_attribute_options_html', function ($html) { | |
$xml = simplexml_load_string($html); | |
$select = array('id' => (string)$xml->attributes()['id'], | |
'name' => (string)$xml->attributes()['name'], | |
'attribute_name' => (string)$xml->attributes()['data-attribute_name'], | |
'show_option_none' => (string)$xml->attributes()['data-show_option_none']); | |
$options = array(); |
<?php | |
// Filter to remove/add payment gateways at checkout | |
add_filter( 'woocommerce_available_payment_gateways', 'mt_disable_gateways' ); | |
function mt_disable_gateways( $available_gateways ) { | |
// Get current user | |
$user = wp_get_current_user(); | |
// Array to handle roles you want to allow this for. | |
$allowed_roles = array( 'administrator'); |