Thank you @James, but I have find out the idea by myself but its similar to yours.
Thank for all the help (:
HI @James,
Thank you for help me so line 42 is Hours: ‘ . $hour->format( ‘h’ ) . ‘<br> him still learn about PHP Development.
Hello @James,
I have fix my source code but getting an error that say in browser
Fatal error: Uncaught Error: Call to a member function format() on unknown in /Applications/MAMP/htdocs/Beta-Sites/wp-content/themes/Pixel-City-Coming-Soon-Theme/lib/theme_acf.php:42 Stack trace: #0 /Applications/MAMP/htdocs/Beta-Sites/wp-includes/plugin.php(525): landing_page_js(”) #1 /Applications/MAMP/htdocs/Beta-Sites/wp-includes/script-loader.php(1027): do_action(‘wp_print_script…’) #2 /Applications/MAMP/htdocs/Beta-Sites/wp-includes/plugin.php(525): wp_print_head_scripts(”) #3 /Applications/MAMP/htdocs/Beta-Sites/wp-includes/general-template.php(2528): do_action(‘wp_head’) #4 /Applications/MAMP/htdocs/Beta-Sites/wp-content/themes/Pixel-City-Coming-Soon-Theme/templates/head.php(5): wp_head() #5 /Applications/MAMP/htdocs/Beta-Sites/wp-includes/template.php(574): require(‘/Applications/M…’) #6 /Applications/MAMP/htdocs/Beta-Sites/wp-includes/template.php(531): load_template(‘/Applications/M…’, false) #7 /Applications/MAMP/htdocs/Beta-Sites/wp-includes/general-template.php(167): locate_template(Array, true, fals in /Applications/MAMP/htdocs/Beta-Sites/wp-content/themes/Pixel-City-Coming-Soon-Theme/lib/theme_acf.php on line 42
add_action( 'wp_print_scripts', 'landing_page_js' );
function landing_page_js() {
// Geting Raw Date
$date = get_field('countdown_timer');
//Check the Fields are not empty else will not run
if(!empty($date) ) {
//Make date object
$date = new DateTime( $date );
echo '
<div class="alert alert-info">
<button type="button" class="close" date-dismiss="alert" aria-hidden="true">&time;</button>
<strong>Time</strong><br>
Day: ' . $date->format( 'd' ) . '<br>
Hours: ' . $hour->format( 'h' ) . '<br>
Minutes: ' . $minute->format( 'h' ) . '<br>
Seconds: ' . $second->format( 's' ) . '<br>
</div>
';
}
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.