-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathfunctions.php
108 lines (76 loc) · 3.59 KB
/
functions.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
<?php
function launcher_setup_theme() {
load_theme_textdomain( "launcher" );
add_theme_support( "post-thumbnails" );
add_theme_support( "title-tag" );
}
add_action( "after_setup_theme", "launcher_setup_theme" );
function launcher_assets() {
//echo basename(get_page_template());
//die();
if(is_page()){
$launcher_template_name = basename(get_page_template());
if($launcher_template_name == "launcher.php"){
wp_enqueue_style( "animate-css", get_theme_file_uri( "/assets/css/animate.css" ) );
wp_enqueue_style( "icomoon-css", get_theme_file_uri( "/assets/css/icomoon.css" ) );
wp_enqueue_style( "bootstrap-css", get_theme_file_uri( "/assets/css/bootstrap.css" ) );
wp_enqueue_style( "style-css", get_theme_file_uri( "/assets/css/style.css" ) );
wp_enqueue_style( "launcher", get_stylesheet_uri(), null, "0.1" );
wp_enqueue_script( "easing-jquery-js", get_theme_file_uri( "/assets/js/jquery.easing.1.3.js" ), array( "jquery" ), null, true );
wp_enqueue_script( "bootstrap-jquery-js", get_theme_file_uri( "/assets/js/bootstrap.min.js" ), array( "jquery" ), null, true );
wp_enqueue_script( "waypoint-jquery-js", get_theme_file_uri( "/assets/js/jquery.waypoints.min.js" ), array( "jquery" ), null, true );
wp_enqueue_script( "countdown-jquery-js", get_theme_file_uri( "/assets/js/simplyCountdown.js" ), array( "jquery" ), null, true );
wp_enqueue_script( "main-jquery-js", get_theme_file_uri( "/assets/js/main.js" ), array( "jquery" ), time(), true );
$launcher_year = get_post_meta( get_the_ID(), "year", true );
$launcher_month = get_post_meta( get_the_ID(), "month", true );
$launcher_day = get_post_meta( get_the_ID(), "day", true );
wp_localize_script( "main-jquery-js", "datedata", array(
"year" => $launcher_year,
"month" => $launcher_month,
"day" => $launcher_day,
) );
}else {
wp_enqueue_style( "bootstrap-css", get_theme_file_uri( "/assets/css/bootstrap.css" ) );
wp_enqueue_style( "launcher", get_stylesheet_uri(), null, "0.1" );
}
}
}
add_action( "wp_enqueue_scripts", "launcher_assets" );
function launcher_sidebars() {
register_sidebar(
array(
'name' => __( 'Footer left', 'launcher' ),
'id' => 'footer-left',
'description' => __( 'Footer left', 'launcher' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
)
);
register_sidebar(
array(
'name' => __( 'Footer right', 'launcher' ),
'id' => 'footer-right',
'description' => __( 'Footer right', 'launcher' ),
'before_widget' => '<section id="%1$s" class="text-right widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
)
);
}
add_action( "widgets_init", "launcher_sidebars" );
function launcher_styles() {
if ( is_page() ) {
$thumbnail_url = get_the_post_thumbnail_url( null, "large" );
?>
<style>
.home-side {
background-image: url(<?php echo $thumbnail_url;?>);
}
</style>
<?php
}
}
add_action( "wp_head", "launcher_styles" );