<?php 

add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
    wp_enqueue_style( 'travel-agency-style', get_template_directory_uri() . '/style.css' );

    wp_enqueue_style( 'travel-agency-child-style'
        , get_stylesheet_directory_uri() . '/child-style.css'
        , array('travel-agency-style') // declare the dependency
                                // in order to load child-style after parent-style
    );
}


add_action( 'wp_ajax_payment_notification', 'payment_notification' ); 
  add_action( 'wp_ajax_nopriv_payment_notification', 'payment_notification' ); 
  function payment_notification(){

 $admin_email = "info@pristinenepal.com";
    $subject = "Online Payment Being Processed";

    $message = '<!DOCTYPE html><html><head><title>Online Payment Being Processed</title>
                </head>
                <body>
                  You have new trip booked message, <br/>';
    $message .= '<label>Trip Name:</label> '. $_POST['trip_name'].' <br/>';
    $message .= '<label>Trip Amount:</label> '. $_POST['trip_amount'].' <br/>';
    $message .= '<label>Name:</label> '. $_POST['user_name'].' <br/>';
     $message .= '<label>Email:</label> '. $_POST['user_email'].' <br/>';

     $message .= '</body></html>';
   
     send_wp_email($admin_email, $subject, $message );

wp_die();
    }


//
function send_wp_email($to, $subject, $message) {
  $headers = array('Content-Type: text/html; charset=UTF-8');
   wp_mail($to,$subject,$message, $headers);
}

//
//Remove "Wordpress" when receiving email 
function remove_from_wordpress($email){
$wpfrom = get_option('blogname');
return $wpfrom;
}
add_filter('wp_mail_from_name', 'remove_from_wordpress');

function travel_agency_pro_header_phone( $fifth = false ){
    $phone       = get_theme_mod( 'phone', __( '(888) 123-45678', 'travel-agency-pro' ) );
    $phone_label = get_theme_mod( 'phone_label', __( 'Call us, we are open 24/7', 'travel-agency-pro' ) );
    
    if( $fifth && $phone ){
        echo '<a href="' . esc_url( 'tel:' . preg_replace( '/[^\d+]/', '', $phone ) ) . '" class="tel-link"><i class="fa fa-phone"></i><span class="phone">' . esc_html( travel_agency_pro_get_header_phone() ) . '</span></a>';
    }elseif( !$fifth && ( $phone_label || $phone ) ){ 
        echo '<div class="right">';
        if( $phone_label ) echo '<span class="phone-label">' . esc_html( travel_agency_pro_get_phone_label() ) . '</span>';
        if( $phone ) echo '<a href="' . esc_url( 'tel:' . preg_replace( '/[^\d+]/', '', $phone ) ) . '" class="tel-link"><span class="phone">' . esc_html( travel_agency_pro_get_header_phone() ) . '</span></a>';
        echo '</div>';
    } 

    //added
    echo '<div class="right yh-right yh-from-child-themes">  
                    <a href="' . esc_url( get_permalink( get_page_by_title( 'Online Payment' ) ) ) . '">                
                    <img src="'. get_stylesheet_directory_uri().'/images/payment-hbl.jpg' . '">
                    </a> 
                </div>';
}

require_once get_stylesheet_directory() . '/yh-hooks.php';