1
|
|
|
<?php |
|
|
|
|
2
|
|
|
namespace LSX\Classes; |
3
|
|
|
|
4
|
|
|
/** |
5
|
|
|
* All the functions for setting up the theme. |
6
|
|
|
* |
7
|
|
|
* @package LSX |
8
|
|
|
* @author LightSpeed |
9
|
|
|
* @license GPL3 |
10
|
|
|
* @link |
11
|
|
|
* @copyright 2023 LightSpeed |
12
|
|
|
*/ |
13
|
|
|
class Frontend { |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Contructor |
17
|
|
|
*/ |
18
|
|
|
public function __construct() { |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Initiate our class. |
23
|
|
|
* |
24
|
|
|
* @return void |
25
|
|
|
*/ |
26
|
|
|
public function init() { |
27
|
|
|
// Styles and Scripts |
|
|
|
|
28
|
|
|
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); |
29
|
|
|
add_action( 'wp_enqueue_scripts', array( $this, 'yoast_faq_asset_files' ) ); |
30
|
|
|
add_action( 'wp_enqueue_scripts', array( $this, 'woo_asset_files' ) ); |
31
|
|
|
|
32
|
|
|
//Output on the frontend. |
|
|
|
|
33
|
|
|
add_filter( 'wpforms_frontend_form_data', array( $this, 'wpforms_match_button_block' ) ); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Enqueues the frontend styles |
38
|
|
|
* |
39
|
|
|
* @return void |
40
|
|
|
*/ |
41
|
|
|
public function enqueue_styles() { |
42
|
|
|
wp_enqueue_style( 'lsx-styles', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) ); |
|
|
|
|
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Load the assets files for Yoast |
48
|
|
|
* |
49
|
|
|
* @return void |
50
|
|
|
*/ |
51
|
|
|
public function yoast_faq_asset_files() { |
52
|
|
|
if ( function_exists( 'wpseo_init' ) ) { |
53
|
|
|
wp_enqueue_style( 'lsx-yoast-faq-css', get_template_directory_uri() . '/assets/css/faq/style.css', array() ); |
|
|
|
|
54
|
|
|
wp_enqueue_script( 'lsx-yoast-faq-js', get_template_directory_uri() . '/assets/js/faq.js', array( "jquery" ), "1.0", true ); |
|
|
|
|
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Load the assets files for Yoast |
60
|
|
|
* |
61
|
|
|
* @return void |
62
|
|
|
*/ |
63
|
|
|
public function woo_asset_files() { |
64
|
|
|
if ( class_exists( 'woocommerce' ) ) { |
65
|
|
|
wp_enqueue_style( 'lsx-woo-css', get_template_directory_uri() . '/assets/css/woocommerce.css', array() ); |
|
|
|
|
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* WPForms submit button, match Gutenberg button block |
71
|
|
|
* |
72
|
|
|
* @param [type] $form_data |
|
|
|
|
73
|
|
|
* @return void |
|
|
|
|
74
|
|
|
*/ |
75
|
|
|
function wpforms_match_button_block( $form_data ) { |
|
|
|
|
76
|
|
|
$form_data['settings']['submit_class'] .= ' btn'; |
77
|
|
|
return $form_data; |
78
|
|
|
} |
79
|
|
|
} |
80
|
|
|
|