Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * Add your own functions here. You can also copy some of the theme functions into this file.
- * Wordpress will use those functions instead of the original functions then.
- */
- function wc_remove_checkout_field( $fields ) {
- unset( $fields['billing']['billing_company'] );
- unset($fields['billing']['billing_address_1']);
- unset($fields['billing']['billing_address_2']);
- unset($fields['billing']['billing_state']);
- unset($fields['billing']['billing_city']);
- unset($fields['billing']['billing_postcode']);
- unset($fields['billing']['billing_phone']);
- unset($fields['order']['order_comments']);
- return $fields;
- }
- add_filter( 'woocommerce_checkout_fields' , 'wc_remove_checkout_field' );
- // Content Views Pro - Change the "No posts found." message
- add_filter( 'pt_cv_content_no_post_found_text', 'cvp_theme_no_post_found_text', 100, 1 );
- function cvp_theme_no_post_found_text( $args ) {
- $args = '';
- return $args;
- }
- function hide_discount_code_field_for_free_levels($show)
- {
- global $pmpro_level;
- if(function_exists('pmpro_isLevelFree') && pmpro_isLevelFree($pmpro_level))
- $show = false;
- return $show;
- }
- add_filter('pmpro_show_discount_code', 'hide_discount_code_field_for_free_levels');
- function hide_discount_code_field_for_specific_levels($show)
- {
- global $pmpro_level;
- if( in_array( $pmpro_level->id, array(1,2,3,5,15,17,18,19,20) ) )
- {
- $show = false;
- }
- return $show;
- }
- add_filter('pmpro_show_discount_code', 'hide_discount_code_field_for_specific_levels');
- /*
- Global to store levels with non-default currencies
- Keys are level ids. Values are an asrray with the currency abbreviation and symbol as the first and second entries.
- */
- global $level_currencies;
- $level_currencies = array(
- 18 => array("EUR", "€"),
- 19 => array("EUR", "€"),
- 20 => array("EUR", "€")
- );
- //main function to check for a currency level and update currencies
- function update_currency_per_level($level_id)
- {
- global $pmpro_currency, $pmpro_currency_symbol, $level_currencies;
- foreach($level_currencies as $level_currency_id => $level_currency)
- {
- if($level_id == $level_currency_id)
- {
- $pmpro_currency = $level_currency[0];
- $pmpro_currency_symbol = $level_currency[1];
- }
- }
- }
- //change currency on checkout page
- function my_pmpro_checkout_level($level)
- {
- update_currency_per_level($level->id);
- return $level;
- }
- add_filter("pmpro_checkout_level", "my_pmpro_checkout_level");
- //change currency when sent as a request param
- function my_init_currency_check()
- {
- if(!empty($_REQUEST['level']))
- return update_currency_per_level(intval($_REQUEST['level']));
- }
- add_action("init", "my_init_currency_check");
- //params in the admin
- function my_admin_init_currency_check()
- {
- if(!empty($_REQUEST['edit']) && !empty($_REQUEST['page']) && $_REQUEST['page'] == 'pmpro-membershiplevels')
- return update_currency_per_level(intval($_REQUEST['edit']));
- }
- add_action("admin_init", "my_admin_init_currency_check");
- add_filter( 'wp_nav_menu_items', 'avia_append_search_nav', 9997, 2 );
- add_filter( 'avf_fallback_menu_items', 'avia_append_search_nav', 9997, 2 );
- function avia_append_search_nav ( $items, $args )
- {
- if(avia_get_option('header_searchicon','header_searchicon') != "header_searchicon") return $items;
- if(avia_get_option('header_position', 'header_top') != "header_top") return $items;
- if ((is_object($args) && !strstr($args->theme_location, 'avia2') && !strstr($args->theme_location, 'avia3')) || (is_string($args) && $args = "fallback_menu"))
- {
- global $avia_config;
- ob_start();
- get_search_form();
- $form = htmlspecialchars(ob_get_clean()) ;
- $items .= '<li id="menu-item-search" class="noMobile menu-item menu-item-search-dropdown menu-item-avia-special">
- <a href="?s=" data-avia-search-tooltip="'.$form.'" '.av_icon_string('search').'><span class="avia_hidden_link_text">'.__('Search','avia_framework').'</span></a>
- </li>';
- }
- return $items;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement