-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path404.php
executable file
·173 lines (164 loc) · 9.28 KB
/
404.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<?php
/**
* The template for displaying 404 pages (Not Found)
*
* @package CarDealer
* @author Potenza Global Solutions
*/
global $car_dealer_options;
get_header(); ?>
<?php get_template_part('template-parts/content','intro'); ?>
<section class="error-404 error-page white-bg page-section-ptb">
<div class="container">
<div class="row">
<div class="col-lg-12 col-md-12">
<div id="primary" class="site-content">
<div id="content" role="main">
<article id="post-0" class="post error404 no-results not-found">
<header class="entry-header">
<?php
if( isset($car_dealer_options['fourofour_enable_page_title']) && $car_dealer_options['fourofour_enable_page_title'] == 1 ) {
$fourofour_page_title = esc_html__( '404! Page Not Found!', 'cardealer' );
if( isset( $car_dealer_options['fourofour_page_title_source'] ) && $car_dealer_options['fourofour_page_title_source'] == 'custom'
&& isset( $car_dealer_options['fourofour_page_title'] ) && !empty($car_dealer_options['fourofour_page_title'])
){
$fourofour_page_title = $car_dealer_options['fourofour_page_title'];
}
?>
<h1 class="page-title text-center"><?php echo esc_html($fourofour_page_title);?></h1>
<?php
}
?>
</header>
<div class="entry-content">
<?php
$page_content_type = 'default';
$page_content_post = '';
if( isset($car_dealer_options['fourofour_page_content_source']) && $car_dealer_options['fourofour_page_content_source'] == 'page'
&& isset($car_dealer_options['fourofour_page_content_page']) && $car_dealer_options['fourofour_page_content_page'] != ''
) {
global $post;
$post_id = $car_dealer_options['fourofour_page_content_page'];
$post = get_post($post_id);
if( $post ){
$page_content_type = 'page';
$page_content_post = $post;
}
}
if( $page_content_type == 'page' ){
$more_link_text= null;
$stripteaser = false;
setup_postdata( $page_content_post, $more_link_text, $stripteaser );
the_content();
wp_reset_postdata();
}else {
$page_content_title = esc_html__('Ooopps...', 'cardealer');
$page_content_subtitle = esc_html__("The Page you were looking for, couldn't be found.", 'cardealer');
$page_content_description= sprintf( wp_kses( __( "Can't find what you looking for? Take a moment and do a search below or start from our <a class='link' href='%s'>Home Page</a>", 'cardealer' ),
array(
'a' => array(
'class' => array(),
'href' => array(),
),
)
),
esc_url( home_url( '/' ) )
);
if( isset( $car_dealer_options['fourofour_page_content_title'] ) && !empty($car_dealer_options['fourofour_page_content_title']) ){
$page_content_title = $car_dealer_options['fourofour_page_content_title'];
}
if( isset( $car_dealer_options['fourofour_page_content_subtitle'] ) && !empty($car_dealer_options['fourofour_page_content_subtitle']) ){
$page_content_subtitle = $car_dealer_options['fourofour_page_content_subtitle'];
}
if( isset( $car_dealer_options['fourofour_page_content_description'] ) && !empty($car_dealer_options['fourofour_page_content_description']) ){
$page_content_description = $car_dealer_options['fourofour_page_content_description'];
}
// 404 Image
if( isset($car_dealer_options['fourofour_page_image']['url'] ) && !empty($car_dealer_options['fourofour_page_image']['url'])){
$img_url = $car_dealer_options['fourofour_page_image']['url'];
}
// Padding
if( isset($car_dealer_options['fourofour_page_content_padding']) && is_array($car_dealer_options['fourofour_page_content_padding']) && !empty($car_dealer_options['fourofour_page_content_padding']) ){
if( isset($car_dealer_options['fourofour_page_content_padding']['padding-top']) && !empty($car_dealer_options['fourofour_page_content_padding']['padding-top']) ) {
$content_style['padding-top'] = 'padding-top:'.$car_dealer_options['fourofour_page_content_padding']['padding-top'];
}
if( isset($car_dealer_options['fourofour_page_content_padding']['padding-right']) && !empty($car_dealer_options['fourofour_page_content_padding']['padding-right']) ) {
$content_style['padding-right'] = 'padding-right:'.$car_dealer_options['fourofour_page_content_padding']['padding-right'];
}
if( isset($car_dealer_options['fourofour_page_content_padding']['padding-bottom']) && !empty($car_dealer_options['fourofour_page_content_padding']['padding-bottom']) ) {
$content_style['padding-bottom'] = 'padding-bottom:'.$car_dealer_options['fourofour_page_content_padding']['padding-bottom'];
}
if( isset($car_dealer_options['fourofour_page_content_padding']['padding-left']) && !empty($car_dealer_options['fourofour_page_content_padding']['padding-left']) ) {
$content_style['padding-left'] = 'padding-left:'.$car_dealer_options['fourofour_page_content_padding']['padding-left'];
}
}
// Margin
if( isset($car_dealer_options['fourofour_page_content_margin']) && is_array($car_dealer_options['fourofour_page_content_margin']) && !empty($car_dealer_options['fourofour_page_content_margin']) ){
if( isset($car_dealer_options['fourofour_page_content_margin']['margin-top']) && !empty($car_dealer_options['fourofour_page_content_margin']['margin-top']) ) {
$content_style['margin-top'] = 'margin-top:'.$car_dealer_options['fourofour_page_content_margin']['margin-top'];
}
if( isset($car_dealer_options['fourofour_page_content_margin']['margin-right']) && !empty($car_dealer_options['fourofour_page_content_margin']['margin-right']) ) {
$content_style['margin-right'] = 'margin-right:'.$car_dealer_options['fourofour_page_content_margin']['margin-right'];
}
if( isset($car_dealer_options['fourofour_page_content_margin']['margin-bottom']) && !empty($car_dealer_options['fourofour_page_content_margin']['margin-bottom']) ) {
$content_style['margin-bottom'] = 'margin-bottom:'.$car_dealer_options['fourofour_page_content_margin']['margin-bottom'];
}
if( isset($car_dealer_options['fourofour_page_content_margin']['margin-left']) && !empty($car_dealer_options['fourofour_page_content_margin']['margin-left']) ) {
$content_style['margin-left'] = 'margin-left:'.$car_dealer_options['fourofour_page_content_margin']['margin-left'];
}
}
if( !empty($content_style) && is_array($content_style) ){
$content_css = implode( ';', array_filter( array_unique( $content_style ) ) );
}
?>
<div class="error-content text-center" style="<?php if(isset($content_css)){echo esc_attr($content_css);}?>">
<h2 class="fourofour"><?php echo esc_html__( '404', 'cardealer' ); ?></h2>
<?php
if(!empty($img_url)){
?>
<img src="<?php echo esc_url($img_url);?>" alt="<?php echo esc_html__( '404', 'cardealer' ); ?>" title="<?php echo esc_html__( '404', 'cardealer' ); ?>"/>
<?php
}else{
?>
<img src="<?php echo esc_url(CARDEALER_URL. '/images/404-error.png'); ?>" alt="<?php echo esc_html__( '404', 'cardealer' ); ?>" title="<?php echo esc_html__( '404', 'cardealer' ); ?>"/>
<?php
}
?>
<h3 class="text-red"><?php echo esc_html($page_content_title);?></h3>
<strong class="text-black"><?php echo esc_html($page_content_subtitle);?> </strong>
<p><?php echo sprintf( wp_kses($page_content_description,
array(
'a' => array(
'class' => array(),
'href' => array(),
),
)
),
esc_url( home_url( '/' ) )
);?>
</p>
<div class="error-search">
<div class="row gray-form no-gutter">
<form role="search" method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<div class="col-md-offset-2 col-md-7 col-sm-10 col-xs-7">
<input type="search" class="form-control" placeholder="<?php echo esc_attr_x( 'Search...', 'placeholder','cardealer' ) ?>" value="<?php echo get_search_query() ?>" name="s" title="<?php echo esc_attr_x( 'Search for:', 'label','cardealer' ) ?>" />
</div>
<div class="col-md-1 col-sm-2 col-xs-4">
<input type="submit" class="button red" value="<?php echo esc_attr_x( 'Search', 'submit button','cardealer' ) ?>" />
</div>
</form>
</div>
</div>
</div>
<?php
}
?>
</div><!-- .entry-content -->
</article><!-- #post-0 -->
</div><!-- #content -->
</div><!-- #primary -->
</div>
</div>
</div>
</section>
<?php get_footer(); ?>