403Webshell
Server IP : 69.39.225.240  /  Your IP : 216.73.216.138
Web Server : Apache
System : Linux bronze7.serverhost.net 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : reademotions ( 1074)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/reademotions/www/wp-content/themes/astra-child/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/reademotions/www/wp-content/themes/astra-child/functions.php
<?php
/**
 * Astra Child  Theme functions and definitions
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
 *
 * @package Astra Child 
 * @since 1.0.0
 */

// disable Gutenberg for posts
add_filter('use_block_editor_for_post', '__return_false', 10);

// disable Gutenberg for post types
add_filter('use_block_editor_for_post_type', '__return_false', 10);



// Hide trailing zeros on prices.
add_filter( 'woocommerce_price_trim_zeros', 'wc_hide_trailing_zeros', 10, 1 );
function wc_hide_trailing_zeros( $trim ) {
    // set to false to show trailing zeros
    return true;
}

//Exclude pages from WordPress Search
if (!is_admin()) {
function wpb_search_filter($query) {
if ($query->is_search) {
$query->set('post_type', 'post');
}
return $query;
}
add_filter('pre_get_posts','wpb_search_filter');
}


/*** Define Constants */
define( 'CHILD_THEME_ASTRA_CHILD_VERSION', '1.0.0' );


/*** Enqueue styles */
function child_enqueue_styles() {

	wp_enqueue_style( 'astra-child-theme-css', get_stylesheet_directory_uri() . '/style.css', array('astra-theme-css'), CHILD_THEME_ASTRA_CHILD_VERSION, 'all' );

}

add_action( 'wp_enqueue_scripts', 'child_enqueue_styles', 15 );


// Replace add to cart button by a linked button to the product in Shop and archives pages
add_filter( 'woocommerce_loop_add_to_cart_link', 'replace_loop_add_to_cart_button', 10, 2 );
function replace_loop_add_to_cart_button( $button, $product  ) {
    // Not needed for variable products
    if( $product->is_type( 'variable' ) ) return $button;

    // Button text here
    $button_text = __( "View Training", "woocommerce" );

    return '<a class="button" href="' . $product->get_permalink() . '">' . $button_text . '</a>';
}

/* Order received Page ------------------------------------------------------ */
function isa_get_wc_print_receipt_link() {
return '<a class="button" href="javascript:window.print()" id="wc-print-button">Print Receipt</a>';
}


/* Show username on Menu Nav My Account */
add_filter( 'wp_nav_menu_objects', 'my_dynamic_menu_items' );
function my_dynamic_menu_items( $menu_items ) {
    foreach ( $menu_items as $menu_item ) {
        if ( strpos($menu_item->title, '#profile_name#') !== false) {
                $menu_item->title =  str_replace("#profile_name#",  wp_get_current_user()->user_firstname, $menu_item->title);
        }
    }

    return $menu_items;
} 


/** Force direct logout 1 */

function change_menu($items){
  foreach($items as $item){
    if( $item->title == "Logout"){
         $item->url = $item->url . "&_wpnonce=" . wp_create_nonce( 'log-out' );
    }
  }
  return $items;

}
add_filter('wp_nav_menu_objects', 'change_menu');


/* Add currency code to prices */
function patricks_currency_symbol( $currency_symbol, $currency ) {
    switch( $currency ) {
        case 'USD':
            $currency_symbol = 'US$';
            break;
        case 'CAD':
            $currency_symbol = 'CA$';
            break;
         case 'NZD':
            $currency_symbol = 'NZ$';
            break;
        case 'AUD':
            $currency_symbol = 'AU$';
            break;
        case 'EUR':
            $currency_symbol = '€';
            break;
    }
    return $currency_symbol;
}
add_filter('woocommerce_currency_symbol', 'patricks_currency_symbol', 30, 2);


/* Hide a row or module when a field connection is empty (Themer) */
function check_field_connections( $is_visible, $node ) {
    
    if ( isset( $node->settings->connections ) ) {
        foreach ( $node->settings->connections as $key => $connection ) {
            if ( ! empty( $connection ) && empty( $node->settings->$key ) ) {
                return false;
            }
        }
    }
    
    return $is_visible;
}

add_filter( 'fl_builder_is_node_visible', 'check_field_connections', 10, 2 );

/* Remove Coupon Form @ WooCommerce Checkout */
remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 );

Youez - 2016 - github.com/yon3zu
LinuXploit