Make WordPress Core

Ticket #56585: functions.php

File functions.php, 3.1 KB (added by pristinenepal, 3 years ago)

this is the file i put in my functions.php plugin

Line 
1<?php 
2
3add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
4function theme_enqueue_styles() {
5    wp_enqueue_style( 'travel-agency-style', get_template_directory_uri() . '/style.css' );
6
7    wp_enqueue_style( 'travel-agency-child-style'
8        , get_stylesheet_directory_uri() . '/child-style.css'
9        , array('travel-agency-style') // declare the dependency
10                                // in order to load child-style after parent-style
11    );
12}
13
14
15add_action( 'wp_ajax_payment_notification', 'payment_notification' ); 
16  add_action( 'wp_ajax_nopriv_payment_notification', 'payment_notification' ); 
17  function payment_notification(){
18
19 $admin_email = "info@pristinenepal.com";
20    $subject = "Online Payment Being Processed";
21
22    $message = '<!DOCTYPE html><html><head><title>Online Payment Being Processed</title>
23                </head>
24                <body>
25                  You have new trip booked message, <br/>';
26    $message .= '<label>Trip Name:</label> '. $_POST['trip_name'].' <br/>';
27    $message .= '<label>Trip Amount:</label> '. $_POST['trip_amount'].' <br/>';
28    $message .= '<label>Name:</label> '. $_POST['user_name'].' <br/>';
29     $message .= '<label>Email:</label> '. $_POST['user_email'].' <br/>';
30
31     $message .= '</body></html>';
32   
33     send_wp_email($admin_email, $subject, $message );
34
35wp_die();
36    }
37
38
39//
40function send_wp_email($to, $subject, $message) {
41  $headers = array('Content-Type: text/html; charset=UTF-8');
42   wp_mail($to,$subject,$message, $headers);
43}
44
45//
46//Remove "Wordpress" when receiving email
47function remove_from_wordpress($email){
48$wpfrom = get_option('blogname');
49return $wpfrom;
50}
51add_filter('wp_mail_from_name', 'remove_from_wordpress');
52
53function travel_agency_pro_header_phone( $fifth = false ){
54    $phone       = get_theme_mod( 'phone', __( '(888) 123-45678', 'travel-agency-pro' ) );
55    $phone_label = get_theme_mod( 'phone_label', __( 'Call us, we are open 24/7', 'travel-agency-pro' ) );
56   
57    if( $fifth && $phone ){
58        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>';
59    }elseif( !$fifth && ( $phone_label || $phone ) ){ 
60        echo '<div class="right">';
61        if( $phone_label ) echo '<span class="phone-label">' . esc_html( travel_agency_pro_get_phone_label() ) . '</span>';
62        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>';
63        echo '</div>';
64    } 
65
66    //added
67    echo '<div class="right yh-right yh-from-child-themes"> 
68                    <a href="' . esc_url( get_permalink( get_page_by_title( 'Online Payment' ) ) ) . '">               
69                    <img src="'. get_stylesheet_directory_uri().'/images/payment-hbl.jpg' . '">
70                    </a>
71                </div>';
72}
73
74require_once get_stylesheet_directory() . '/yh-hooks.php';