Skip to content

Commit

Permalink
custom field and passing data to js files
Browse files Browse the repository at this point in the history
  • Loading branch information
hasinhayder committed May 27, 2018
1 parent 84ee321 commit a16f154
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 14 deletions.
7 changes: 4 additions & 3 deletions assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,11 @@

var countDown = function() {

console.log(datedata);
simplyCountdown('.simply-countdown-one', {
year: "2018",
month: "05",
day: "30"
year: datedata.year,
month: datedata.month,
day: datedata.day
});

};
Expand Down
28 changes: 20 additions & 8 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,24 @@ function launcher_assets() {
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_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" ), "0.1", 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,
) );
}

add_action( "wp_enqueue_scripts", "launcher_assets" );
Expand Down Expand Up @@ -54,19 +65,20 @@ function launcher_sidebars() {
add_action( "widgets_init", "launcher_sidebars" );


function launcher_styles(){
if(is_page()){
$thumbnail_url = get_the_post_thumbnail_url(null,"large");
function launcher_styles() {
if ( is_page() ) {
$thumbnail_url = get_the_post_thumbnail_url( null, "large" );
?>
<style>
.home-side{
.home-side {
background-image: url(<?php echo $thumbnail_url;?>);
}
</style>
<?php
<?php
}
}
add_action("wp_head","launcher_styles");

add_action( "wp_head", "launcher_styles" );



Expand Down
13 changes: 10 additions & 3 deletions launcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
<?php
the_post();
get_header();

$placeholder_text = get_post_meta(get_the_ID(),"placeholder",true);
$button_label = get_post_meta(get_the_ID(),"button label",true);
$hint = get_post_meta(get_the_ID(),"hint",true);

?>
<body>
<div class="fh5co-loader"></div>
Expand Down Expand Up @@ -36,9 +41,11 @@
<div class="col-lg-7 animate-box">
<form action="#" id="fh5co-subscribe">
<div class="form-group">
<input type="text" class="form-control" placeholder="Enter your email">
<input type="submit" value="Send" class="btn btn-primary">
<p class="tip">Please enter your email address for early access.</p>
<input type="text" class="form-control" placeholder="<?php echo esc_attr($placeholder_text); ?>">
<input type="submit" value="<?php echo esc_attr($button_label); ?>" class="btn btn-primary">
<p class="tip">
<?php echo esc_html($hint); ?>
</p>
</div>
</form>
</div>
Expand Down

0 comments on commit a16f154

Please sign in to comment.