Make WordPress Themes

source: tour-travel-agent/0.6.1/functions.php

Last change on this file was 274095, checked in by themedropbox, 6 months ago

New version of Tour Travel Agent - 0.6

File size: 26.1 KB
Line 
1<?php
2/**
3 * Tour Travel Agent functions and definitions
4 *
5 * @package Tour Travel Agent
6 */
7
8/**
9 * Set the content width based on the theme's design and stylesheet.
10 */
11/* Breadcrumb Begin */
12function tour_travel_agent_the_breadcrumb() {
13        if (!is_home()) {
14                echo '<a href="';
15                        echo esc_url( home_url() );
16                echo '">';
17                        bloginfo('name');
18                echo "</a> ";
19                if (is_category() || is_single()) {
20                        the_category(',');
21                        if (is_single()) {
22                                echo "<span> ";
23                                        the_title();
24                                echo "</span> ";
25                        }
26                } elseif (is_page()) {
27                        echo "<span> ";
28                                the_title();
29                }
30        }
31}
32
33/* Theme Setup */
34if ( ! function_exists( 'tour_travel_agent_setup' ) ) :
35
36function tour_travel_agent_setup() {
37
38        $GLOBALS['content_width'] = apply_filters( 'tour_travel_agent_content_width', 640 );
39
40        add_theme_support( 'automatic-feed-links' );
41        add_theme_support( 'post-thumbnails' );
42        add_theme_support( 'woocommerce' );
43        add_theme_support( 'align-wide' );
44        add_theme_support( 'wp-block-styles' );
45        add_theme_support( 'title-tag' );
46        add_theme_support( 'custom-logo', array(
47                'height'      => 240,
48                'width'       => 240,
49                'flex-height' => true,
50        ) );
51        add_image_size('tour-travel-agent-homepage-thumb',240,145,true);
52       
53        register_nav_menus( array(
54                'primary' => __( 'Primary Menu', 'tour-travel-agent' ),
55        ) );
56
57        add_theme_support( 'custom-background', array(
58                'default-color' => 'f1f1f1'
59        ) );
60       
61        add_theme_support ('html5', array (
62        'search-form', 'comment-form', 'comment-list', 'gallery', 'caption'
63    ) );
64
65        add_theme_support('responsive-embeds');
66
67        /* Selective refresh for widgets */
68        add_theme_support( 'customize-selective-refresh-widgets' );
69
70        /*
71         * This theme styles the visual editor to resemble the theme style,
72         * specifically font, colors, icons, and column width.
73         */
74        add_editor_style( array( 'css/editor-style.css', tour_travel_agent_font_url() ) );
75       
76                // Dashboard Theme Notification
77        global $pagenow;
78       
79        if ( is_admin() && ('themes.php' == $pagenow) && isset( $_GET['activated'] ) ) {
80                add_action( 'admin_notices', 'tour_travel_agent_activation_notice' );
81        }       
82
83}
84endif;
85add_action( 'after_setup_theme', 'tour_travel_agent_setup' );
86
87// Dashboard Theme Notification   
88function tour_travel_agent_activation_notice() {
89        echo '<div class="notice is-dismissible tour-travel-agent-notice">';
90                echo '<div class="tour-travel-agent-banner">';
91                        echo '<div class="tour-travel-agent-text">';
92                                echo '<h2>' . esc_html__( 'Thanks For Installing the "Tour Travel Agent" Theme !', 'tour-travel-agent' ) . '</h2>';
93                                echo '<p>' . esc_html__( 'We’re excited to help you get started with your new theme! Set up your website quickly and easily by importing our demo content and customizing it to suit your needs.', 'tour-travel-agent' ) . '</p>';
94                                echo '<div class="tour-travel-agent-buttons">';
95                                        echo '<a href="' . esc_url( admin_url( 'themes.php?page=tour_travel_agent_guide' ) ) . '">' . esc_html__( 'Demo Import', 'tour-travel-agent' ) . '</a>';
96                                        echo '<a href="'. esc_url( 'https://preview.themescaliber.com/doc/free-travel-wordpress-theme/' ) .'" target=_blank>' . esc_html__( 'Documentation', 'tour-travel-agent' ) . '</a>';
97                                        echo '<a href="'. esc_url( 'https://www.themescaliber.com/products/travel-agent-wordpress-theme' ) .'" target=_blank>' . esc_html__( 'Get Premium', 'tour-travel-agent' ) . '</a>';
98                                echo '</div>';
99                        echo '</div>';
100                        echo '<div class="tour-travel-agent-image">';
101                                echo '<img src="' . esc_url(get_template_directory_uri()) . '/images/demo-preview.png">';
102                        echo '</div>';
103                echo '</div>';
104    echo '</div>';
105}
106
107/* Theme Widgets Setup */
108function tour_travel_agent_widgets_init() {
109        register_sidebar( array(
110                'name'          => __( 'Blog Sidebar', 'tour-travel-agent' ),
111                'description'   => __( 'Appears on blog page sidebar', 'tour-travel-agent' ),
112                'id'            => 'sidebar-1',
113                'before_widget' => '<aside id="%1$s" class="widget %2$s p-2">',
114                'after_widget'  => '</aside>',
115                'before_title'  => '<h3 class="widget-title">',
116                'after_title'   => '</h3>',
117        ) );
118       
119        register_sidebar( array(
120                'name'          => __( 'Page Sidebar', 'tour-travel-agent' ),
121                'description'   => __( 'Appears on page sidebar', 'tour-travel-agent' ),
122                'id'            => 'sidebar-2',
123                'before_widget' => '<aside id="%1$s" class="widget %2$s p-2">',
124                'after_widget'  => '</aside>',
125                'before_title'  => '<h3 class="widget-title">',
126                'after_title'   => '</h3>',
127        ) );
128
129        register_sidebar( array(
130                'name'         => __( 'Third Column Sidebar', 'tour-travel-agent' ),
131                'description' => __( 'Appears on page sidebar', 'tour-travel-agent' ),
132                'id'            => 'sidebar-3',
133                'before_widget' => '<aside id="%1$s" class="widget %2$s p-2">',
134                'after_widget'  => '</aside>',
135                'before_title'  => '<h3 class="widget-title">',
136                'after_title'   => '</h3>',
137        ) );
138
139        //Footer widget areas
140        $tour_travel_agent_widget_areas = get_theme_mod('tour_travel_agent_footer_widget_layout', '4');
141        for ($i=1; $i<=$tour_travel_agent_widget_areas; $i++) {
142                register_sidebar( array(
143                        'name'          => __( 'Footer Nav ', 'tour-travel-agent' ) . $i,
144                        'id'            => 'footer-' . $i,
145                        'description'   => '',
146                        'before_widget' => '<aside id="%1$s" class="widget %2$s py-2">',
147                        'after_widget'  => '</aside>',
148                        'before_title'  => '<h3 class="widget-title">',
149                        'after_title'   => '</h3>',
150                ) );
151        }
152        register_sidebar( array(
153                'name'          => __( 'Shop Page Sidebar', 'tour-travel-agent' ),
154                'description'   => __( 'Appears on shop page', 'tour-travel-agent' ),   
155                'id'            => 'woocommerce_sidebar',
156                'before_widget' => '<aside id="%1$s" class="widget %2$s">',
157                'after_widget'  => '</aside>',
158                'before_title'  => '<h3 class="widget-title">',
159                'after_title'   => '</h3>',
160        ) );
161        register_sidebar( array(
162                'name'          => __( 'Single Product Page Sidebar', 'tour-travel-agent' ),
163                'description'   => __( 'Appears on shop page', 'tour-travel-agent' ),
164                'id'            => 'woocommerce-single-sidebar',
165                'before_widget' => '<aside id="%1$s" class="widget %2$s">',
166                'after_widget'  => '</aside>',
167                'before_title'  => '<h3 class="widget-title">',
168                'after_title'   => '</h3>',
169        ) );
170}
171add_action( 'widgets_init', 'tour_travel_agent_widgets_init' );
172
173/* Theme Font URL */
174function tour_travel_agent_font_url() {
175        $font_url = '';
176        $font_family = array(
177            'ABeeZee:ital@0;1',
178                'Abril Fatfac',
179                'Acme',
180                'Allura',
181                'Amatic SC:wght@400;700',
182                'Anton',
183                'Architects Daughter',
184                'Archivo:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900',
185                'Arimo:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700',
186                'Arsenal:ital,wght@0,400;0,700;1,400;1,700',
187                'Arvo:ital,wght@0,400;0,700;1,400;1,700',
188                'Alegreya:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900;1,400;1,500;1,600;1,700;1,800;1,900',
189                'Asap:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900',
190                'Assistant:wght@200;300;400;500;600;700;800',
191                'Alfa Slab One',
192                'Averia Serif Libre:ital,wght@0,300;0,400;0,700;1,300;1,400;1,700',
193                'Bangers',
194                'Boogaloo',
195                'Bad Script',
196                'Barlow:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900',
197                'Barlow Condensed:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900',
198                'Berkshire Swash',
199                'Bitter:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900',
200                'Bree Serif',
201                'BenchNine:wght@300;400;700',
202                'Cabin:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700',
203                'Cardo:ital,wght@0,400;0,700;1,400',
204                'Courgette',
205                'Caveat:wght@400;500;600;700',
206                'Caveat Brush',
207                'Cherry Swash:wght@400;700',
208                'Comfortaa:wght@300;400;500;600;700',
209                'Cormorant Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700',
210                'Crimson Text:ital,wght@0,400;0,600;0,700;1,400;1,600;1,700',
211                'Cuprum:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700',
212                'Cookie',
213                'Coming Soon',
214                'Charm:wght@400;700',
215                'Chewy',
216                'Days One',
217                'DM Serif Display:ital@0;1',
218                'Dosis:wght@200;300;400;500;600;700;800',
219                'EB Garamond:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400;1,500;1,600;1,700;1,800',
220                'Economica:ital,wght@0,400;0,700;1,400;1,700',
221                'Epilogue:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900',
222                'Exo 2:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900',
223                'Familjen Grotesk:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700',
224                'Fira Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900',
225                'Fredoka One',
226                'Fjalla One',
227                'Francois One',
228                'Frank Ruhl Libre:wght@300;400;500;700;900',
229                'Gabriela',
230                'Gloria Hallelujah',
231                'Great Vibes',
232                'Handlee',
233                'Hammersmith One',
234                'Heebo:wght@100;200;300;400;500;600;700;800;900',
235                'Hind:wght@300;400;500;600;700',
236                'Inconsolata:wght@200;300;400;500;600;700;800;900',
237                'Indie Flower',
238                'IM Fell English SC',
239                'Jura:wght@300;400;500;600;700',
240                'Julius Sans One',
241                'Jomhuria',
242                'Josefin Slab:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700',
243                'Josefin Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700',
244                'Jost:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900',
245                'Kaisei HarunoUmi:wght@400;500;700',
246                'Kanit:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900',
247                'Kaushan Script',
248                'Krub:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;1,200;1,300;1,400;1,500;1,600;1,700',
249                'Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900',
250                'Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700',
251                'Libre Baskerville:ital,wght@0,400;0,700;1,400',
252                'Lobster',
253                'Lobster Two:ital,wght@0,400;0,700;1,400;1,700',
254                'Martel:wght@200;300;400;600;700;800;900',
255                'Merriweather:ital,wght@0,300;0,400;0,700;0,900;1,300;1,400;1,700;1,900',
256                'Monda:wght@400;700',
257                'Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900',
258                'Mulish:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900',
259                'Marck Script',
260                'Marcellus',
261                'Merienda One',
262                'Monda:wght@400;700',
263                'Noto Serif:ital,wght@0,400;0,700;1,400;1,700',
264                'Nunito Sans:ital,wght@0,200;0,300;0,400;0,600;0,700;0,800;0,900;1,200;1,300;1,400;1,600;1,700;1,800;1,900',
265                'Open Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,300;1,400;1,500;1,600;1,700;1,800',
266                'Overpass:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900',
267                'Overpass Mono:wght@300;400;500;600;700',
268                'Oxygen:wght@300;400;700',
269                'Oswald:wght@200;300;400;500;600;700',
270                'Orbitron:wght@400;500;600;700;800;900',
271                'Patua One',
272                'Pacifico',
273                'Padauk:wght@400;700',
274                'Playball',
275                'Playfair Display:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900;1,400;1,500;1,600;1,700;1,800;1,900',
276                'Prompt:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900',
277                'PT Sans:ital,wght@0,400;0,700;1,400;1,700',
278                'PT Serif:ital,wght@0,400;0,700;1,400;1,700',
279                'Philosopher:ital,wght@0,400;0,700;1,400;1,700',
280                'Permanent Marker',
281                'Poiret One',
282                'Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900',
283                'Prata',
284                'Quicksand:wght@300;400;500;600;700',
285                'Quattrocento Sans:ital,wght@0,400;0,700;1,400;1,700',
286                'Raleway:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900',
287                'Rubik:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900',
288                'Roboto Condensed:ital,wght@0,300;0,400;0,700;1,300;1,400;1,700',
289                'Rokkitt:wght@100;200;300;400;500;600;700;800;900',
290                'Ropa Sans:ital@0;1',
291                'Russo One',
292                'Righteous',
293                'Saira:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900',
294                'Satisfy',
295                'Sen:wght@400;700;800',
296                'Slabo 13px',
297                'Slabo 27px',
298                'Source Sans Pro:ital,wght@0,200;0,300;0,400;0,600;0,700;0,900;1,200;1,300;1,400;1,600;1,700;1,900',
299                'Shadows Into Light Two',
300                'Shadows Into Light',
301                'Sacramento',
302                'Sail',
303                'Shrikhand',
304                'League Spartan:wght@100;200;300;400;500;600;700;800;900',
305                'Staatliches',
306                'Stylish',
307                'Tangerine:wght@400;700',
308                'Titillium Web:ital,wght@0,200;0,300;0,400;0,600;0,700;0,900;1,200;1,300;1,400;1,600;1,700',
309                'Trirong:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900',
310                'Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700',
311                'Unica One',
312                'VT323',
313                'Varela Round',
314                'Vampiro One',
315                'Vollkorn:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900;1,400;1,500;1,600;1,700;1,800;1,900',
316                'Volkhov:ital,wght@0,400;0,700;1,400;1,700',
317                'Work Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900',
318                'Yanone Kaffeesatz:wght@200;300;400;500;600;700',
319                'Yeseva One',
320                'ZCOOL XiaoWei'
321        );
322
323        $query_args = array(
324                'family'        => rawurlencode(implode('|',$font_family)),
325        );
326        $font_url = add_query_arg($query_args,'//fonts.googleapis.com/css');
327        return $font_url;
328        $contents = tour_travel_agent_wptt_get_webfont_url( esc_url_raw( $fonts_url ) );
329}
330
331/* Theme enqueue scripts */
332function tour_travel_agent_scripts() {
333        wp_enqueue_style( 'tour-travel-agent-font', tour_travel_agent_font_url(), array() );
334        wp_enqueue_style( 'bootstrap-css', get_template_directory_uri().'/css/bootstrap.css' );
335        wp_enqueue_style( 'tour-travel-agent-basic-style', get_stylesheet_uri() );
336        wp_style_add_data( 'tour-travel-agent-style', 'rtl', 'replace' );
337        wp_enqueue_style( 'font-awesome-css', get_template_directory_uri().'/css/fontawesome-all.css' );
338        wp_enqueue_style( 'owl.carousel-style', get_template_directory_uri().'/css/owl.carousel.css' );
339        wp_enqueue_style( 'tour-travel-agent-block-style', get_template_directory_uri().'/css/block-style.css' );
340
341    // Body
342    $tour_travel_agent_body_color = get_theme_mod('tour_travel_agent_body_color', '');
343    $tour_travel_agent_body_font_family = get_theme_mod('tour_travel_agent_body_font_family', '');
344    $tour_travel_agent_body_font_size = get_theme_mod('tour_travel_agent_body_font_size', '');
345        $tour_travel_agent_body_font_weight = get_theme_mod('tour_travel_agent_body_font_weight', '');
346
347        // Paragraph
348    $tour_travel_agent_paragraph_color = get_theme_mod('tour_travel_agent_paragraph_color', '');
349    $tour_travel_agent_paragraph_font_family = get_theme_mod('tour_travel_agent_paragraph_font_family', '');
350    $tour_travel_agent_paragraph_font_size = get_theme_mod('tour_travel_agent_paragraph_font_size', '');
351        $tour_travel_agent_paragraph_font_weight = get_theme_mod('tour_travel_agent_paragraph_font_weight', '');
352        // "a" tag
353        $tour_travel_agent_atag_color = get_theme_mod('tour_travel_agent_atag_color', '');
354    $tour_travel_agent_atag_font_family = get_theme_mod('tour_travel_agent_atag_font_family', '');
355        // "li" tag
356        $tour_travel_agent_li_color = get_theme_mod('tour_travel_agent_li_color', '');
357    $tour_travel_agent_li_font_family = get_theme_mod('tour_travel_agent_li_font_family', '');
358        // H1
359        $tour_travel_agent_h1_color = get_theme_mod('tour_travel_agent_h1_color', '');
360    $tour_travel_agent_h1_font_family = get_theme_mod('tour_travel_agent_h1_font_family', '');
361    $tour_travel_agent_h1_font_size = get_theme_mod('tour_travel_agent_h1_font_size', '');
362        $tour_travel_agent_h1_font_weight = get_theme_mod('tour_travel_agent_h1_font_weight', '');
363        // H2
364        $tour_travel_agent_h2_color = get_theme_mod('tour_travel_agent_h2_color', '');
365    $tour_travel_agent_h2_font_family = get_theme_mod('tour_travel_agent_h2_font_family', '');
366    $tour_travel_agent_h2_font_size = get_theme_mod('tour_travel_agent_h2_font_size', '');
367        $tour_travel_agent_h2_font_weight = get_theme_mod('tour_travel_agent_h1_font_weight', '');
368        // H3
369        $tour_travel_agent_h3_color = get_theme_mod('tour_travel_agent_h3_color', '');
370    $tour_travel_agent_h3_font_family = get_theme_mod('tour_travel_agent_h3_font_family', '');
371    $tour_travel_agent_h3_font_size = get_theme_mod('tour_travel_agent_h3_font_size', '');
372        $tour_travel_agent_h3_font_weight = get_theme_mod('tour_travel_agent_h1_font_weight', '');
373        // H4
374        $tour_travel_agent_h4_color = get_theme_mod('tour_travel_agent_h4_color', '');
375    $tour_travel_agent_h4_font_family = get_theme_mod('tour_travel_agent_h4_font_family', '');
376    $tour_travel_agent_h4_font_size = get_theme_mod('tour_travel_agent_h4_font_size', '');
377        $tour_travel_agent_h4_font_weight = get_theme_mod('tour_travel_agent_h1_font_weight', '');
378        // H5
379        $tour_travel_agent_h5_color = get_theme_mod('tour_travel_agent_h5_color', '');
380    $tour_travel_agent_h5_font_family = get_theme_mod('tour_travel_agent_h5_font_family', '');
381    $tour_travel_agent_h5_font_size = get_theme_mod('tour_travel_agent_h5_font_size', '');
382        $tour_travel_agent_h5_font_weight = get_theme_mod('tour_travel_agent_h1_font_weight', '');
383        // H6
384        $tour_travel_agent_h6_color = get_theme_mod('tour_travel_agent_h6_color', '');
385    $tour_travel_agent_h6_font_family = get_theme_mod('tour_travel_agent_h6_font_family', '');
386    $tour_travel_agent_h6_font_size = get_theme_mod('tour_travel_agent_h6_font_size', '');
387        $tour_travel_agent_h6_font_weight = get_theme_mod('tour_travel_agent_h1_font_weight', '');
388        //footer icon color
389        $tour_travel_agent_footer_icon_color = get_theme_mod('tour_travel_agent_footer_icon_color', '');       
390
391        $tour_travel_agent_custom_css ='
392            body{
393                    color:'.esc_html($tour_travel_agent_body_color).'!important;
394                    font-family: '.esc_html($tour_travel_agent_body_font_family).'!important;
395                    font-size: '.esc_html($tour_travel_agent_body_font_size).'px !important;
396                        font-weight: '.esc_attr($tour_travel_agent_body_font_weight).'!important;
397                }
398                p,span{
399                    color:'.esc_attr($tour_travel_agent_paragraph_color).'!important;
400                    font-family: '.esc_attr($tour_travel_agent_paragraph_font_family).'!important;
401                    font-size: '.esc_attr($tour_travel_agent_paragraph_font_size).'px !important;
402                        font-weight: '.esc_attr($tour_travel_agent_paragraph_font_weight).'!important;
403                }
404                a{
405                    color:'.esc_attr($tour_travel_agent_atag_color).'!important;
406                    font-family: '.esc_attr($tour_travel_agent_atag_font_family).';
407                }
408                li{
409                    color:'.esc_attr($tour_travel_agent_li_color).'!important;
410                    font-family: '.esc_attr($tour_travel_agent_li_font_family).';
411                }
412                h1{
413                    color:'.esc_attr($tour_travel_agent_h1_color).'!important;
414                    font-family: '.esc_attr($tour_travel_agent_h1_font_family).'!important;
415                    font-size: '.esc_attr($tour_travel_agent_h1_font_size).'px !important;
416                        font-weight: '.esc_attr($tour_travel_agent_h1_font_weight).'!important;
417                }
418                h2{
419                    color:'.esc_attr($tour_travel_agent_h2_color).'!important;
420                    font-family: '.esc_attr($tour_travel_agent_h2_font_family).'!important;
421                    font-size: '.esc_attr($tour_travel_agent_h2_font_size).'px !important;
422                        font-weight: '.esc_attr($tour_travel_agent_h2_font_weight).'!important;
423                }
424                h3{
425                    color:'.esc_attr($tour_travel_agent_h3_color).'!important;
426                    font-family: '.esc_attr($tour_travel_agent_h3_font_family).'!important;
427                    font-size: '.esc_attr($tour_travel_agent_h3_font_size).'px !important;
428                        font-weight: '.esc_attr($tour_travel_agent_h3_font_weight).'!important;
429                }
430                h4{
431                    color:'.esc_attr($tour_travel_agent_h4_color).'!important;
432                    font-family: '.esc_attr($tour_travel_agent_h4_font_family).'!important;
433                    font-size: '.esc_attr($tour_travel_agent_h4_font_size).'px !important;
434                        font-weight: '.esc_attr($tour_travel_agent_h4_font_weight).'!important;
435                }
436                h5{
437                    color:'.esc_attr($tour_travel_agent_h5_color).'!important;
438                    font-family: '.esc_attr($tour_travel_agent_h5_font_family).'!important;
439                    font-size: '.esc_attr($tour_travel_agent_h5_font_size).'px !important;
440                        font-weight: '.esc_attr($tour_travel_agent_h5_font_weight).'!important;
441                }
442                h6{
443                    color:'.esc_attr($tour_travel_agent_h6_color).'!important;
444                    font-family: '.esc_attr($tour_travel_agent_h6_font_family).'!important;
445                    font-size: '.esc_attr($tour_travel_agent_h6_font_size).'px !important;
446                        font-weight: '.esc_attr($tour_travel_agent_h6_font_weight).'!important;
447                }
448                #footer .socialicons i{
449                        color:'.esc_attr($tour_travel_agent_footer_icon_color).'!important;
450            }                   
451
452                ';
453        wp_add_inline_style( 'tour-travel-agent-basic-style',$tour_travel_agent_custom_css );
454
455        require get_parent_theme_file_path( '/tc-style.php' );
456        wp_add_inline_style( 'tour-travel-agent-basic-style',$tour_travel_agent_custom_css );
457
458        wp_enqueue_script( 'bootstrap-js', get_template_directory_uri() . '/js/bootstrap.js' );
459        wp_enqueue_script( 'tour-travel-agent-custom-jquery', get_template_directory_uri() . '/js/custom.js', array('jquery') );
460        wp_enqueue_script( 'jquery-superfish', get_template_directory_uri() . '/js/jquery.superfish.js', array('jquery') ,'',true);
461        wp_enqueue_script( 'owl.carousel-js', get_template_directory_uri(). '/js/owl.carousel.js', array('jquery') ,'',true);
462        if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
463                wp_enqueue_script( 'comment-reply' );
464        }
465}
466add_action( 'wp_enqueue_scripts', 'tour_travel_agent_scripts' );
467
468/*radio button sanitization*/
469
470function tour_travel_agent_sanitize_choices( $input, $setting ) {
471    global $wp_customize; 
472    $control = $wp_customize->get_control( $setting->id ); 
473    if ( array_key_exists( $input, $control->choices ) ) {
474        return $input;
475    } else {
476        return $setting->default;
477    }
478}
479
480/* Excerpt Limit Begin */
481function tour_travel_agent_string_limit_words($string, $word_limit) {
482        if ($word_limit == 0) {
483        return ''; // Return an empty string if word limit is 0
484    }
485        $words = explode(' ', $string, ($word_limit + 1));
486        if(count($words) > $word_limit){
487                array_pop($words);
488        }
489        return implode(' ', $words);
490}
491
492function tour_travel_agent_sanitize_dropdown_pages( $page_id, $setting ) {
493        // Ensure $input is an absolute integer.
494        $page_id = absint( $page_id );
495
496        // If $page_id is an ID of a published page, return it; otherwise, return the default.
497        return ( 'publish' == get_post_status( $page_id ) ? $page_id : $setting->default );
498}
499function tour_travel_agent_my_setup() {
500        // URL DEFINES
501        define('TOUR_TRAVEL_AGENT_SITE_URL',__('https://www.themescaliber.com/products/free-travel-wordpress-theme','tour-travel-agent'));
502        define('TOUR_TRAVEL_AGENT_FREE_THEME_DOC',__('https://preview.themescaliber.com/doc/free-travel-wordpress-theme/','tour-travel-agent'));
503        define('TOUR_TRAVEL_AGENT_SUPPORT',__('https://wordpress.org/support/theme/tour-travel-agent/','tour-travel-agent'));
504        define('TOUR_TRAVEL_AGENT_REVIEW',__('https://wordpress.org/support/theme/tour-travel-agent/reviews/','tour-travel-agent'));
505        define('TOUR_TRAVEL_AGENT_BUY_NOW',__('https://www.themescaliber.com/products/travel-agent-wordpress-theme','tour-travel-agent'));
506        define('TOUR_TRAVEL_AGENT_LIVE_DEMO',__('https://preview.themescaliber.com/tour-travel-agent-pro/','tour-travel-agent'));
507        define('TOUR_TRAVEL_AGENT_PRO_DOC',__('https://preview.themescaliber.com/doc/tour-travel-agent-pro/','tour-travel-agent'));
508        define('TOUR_TRAVEL_AGENT_CHILD_THEME',__('https://developer.wordpress.org/themes/advanced-topics/child-themes/','tour-travel-agent'));
509    }
510add_action( 'after_setup_theme', 'tour_travel_agent_my_setup' );
511
512function tour_travel_agent_credit_link() {
513    echo "<a href=".esc_url(TOUR_TRAVEL_AGENT_SITE_URL)." target='_blank'>".esc_html__('Travel Agent WordPress Theme','tour-travel-agent')."</a>";
514}
515
516function tour_travel_agent_grid_excerpt_enabled(){
517        if(get_theme_mod('tour_travel_agent_grid_post_content') == 'Excerpt Content' ) {
518                return true;
519        }
520        return false;
521}
522
523// Change number or products per row to 3
524add_filter('loop_shop_columns', 'tour_travel_agent_loop_columns');
525if (!function_exists('tour_travel_agent_loop_columns')) {
526        function tour_travel_agent_loop_columns() {
527                $columns = get_theme_mod( 'tour_travel_agent_products_per_row', 3 );
528                return $columns; // 3 products per row
529        }
530}
531
532//Change number of products that are displayed per page (shop page)
533add_filter( 'loop_shop_per_page', 'tour_travel_agent_shop_per_page', 9 );
534function tour_travel_agent_shop_per_page( $cols ) {
535        $cols = get_theme_mod( 'tour_travel_agent_product_per_page', 9 );
536        return $cols;
537}
538
539function tour_travel_agent_blog_post_featured_image_dimension(){
540        if(get_theme_mod('tour_travel_agent_blog_post_featured_image_dimension') == 'custom' ) {
541                return true;
542        }
543        return false;
544}
545
546function tour_travel_agent_sanitize_checkbox( $input ) {
547        // Boolean check
548        return ( ( isset( $input ) && true == $input ) ? true : false );
549}
550
551function tour_travel_agent_sanitize_float( $input ) {
552    return filter_var($input, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
553}
554
555/** Posts navigation. */
556if ( ! function_exists( 'tour_travel_agent_post_navigation' ) ) {
557        function tour_travel_agent_post_navigation() {
558                $tour_travel_agent_pagination_type = get_theme_mod( 'tour_travel_agent_post_navigation_type', 'numbers' );
559                if ( $tour_travel_agent_pagination_type == 'numbers' ) {
560                        the_posts_pagination();
561                } else {
562                        the_posts_navigation( array(
563                    'prev_text'          => __( 'Previous page', 'tour-travel-agent' ),
564                    'next_text'          => __( 'Next page', 'tour-travel-agent' ),
565                    'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'tour-travel-agent' ) . ' </span>',
566                ) );
567                }
568        }
569}
570
571/* Custom template tags for this theme. */
572require get_template_directory() . '/inc/template-tags.php';
573
574/* Implement the Custom Header feature. */
575require get_template_directory() . '/inc/custom-header.php';
576
577/* Customizer additions. */
578require get_template_directory() . '/inc/customizer.php';
579
580/* Implement the get started page */
581require get_template_directory() . '/inc/dashboard/getstart.php';
582
583/* Webfonts */
584require get_template_directory() . '/wptt-webfont-loader.php';
585
586/* TGM Plugin Activation */
587require get_template_directory() . '/inc/tgm/tgm.php';
Note: See TracBrowser for help on using the repository browser.