PATH:
home
/
lab2454c
/
carbonbullion.net
/
wp-content
/
themes
/
carbon-bullion
<?php /** * Template Name: Home Page */ // For every Monday until 01/09/2022 $base_line = '2022-09-01'; $current_date = date('Y-m-d'); $array_all = $array_all_sector_unit = $marquee_urls = $urls = []; $date = date('Y-m-d'); $prev_date = date('Y-m-d', strtotime($date . ' -4 day')); while (strtotime($date) >= strtotime($prev_date)) { array_push($urls, 'https://api.kyotounit.com/?action=get_co2_sector_emissions_by_date&value=' . $date); $date = date("Y-m-d", strtotime("-1 day", strtotime($date))); } $data = !empty($urls) ? curlMultiUrls($urls) : []; if (!empty($data)) { $flag = 1; foreach ($data as $key => $value) { $results = json_decode($value); if (!empty($results)) { foreach ($results as $r_key => $r_value) { if ($flag > 1) { $array_all_sector_unit[$r_value->sector][] = $r_value; } } } $flag++; } } if(date('j', strtotime($current_date)) === '1'){ $last_monday = date('Y-m-d', strtotime($current_date . ' -7 day')); }else{ $last_monday = date('Y-m-d',strtotime("last Monday")); } //$previous_monday = date('Y-m-d', strtotime($last_monday . ' -7 day')); while (strtotime($last_monday) >= strtotime($base_line)) { array_push($marquee_urls, 'https://api.kyotounit.com/?action=get_co2_sector_emissions_by_date&value=' . $last_monday); $last_monday = date("Y-m-d", strtotime("-7 day", strtotime($last_monday))); } array_push($marquee_urls, 'https://api.kyotounit.com/?action=get_co2_sector_emissions_by_date&value=2022-09-01'); $marquee_data = !empty($marquee_urls) ? curlMultiUrls($marquee_urls) : []; if (!empty($marquee_data)) { $flag = 1; foreach ($marquee_data as $key => $value) { $results = json_decode($value); if (!empty($results)) { foreach ($results as $r_key => $r_value) { $array_all[$r_value->sector][] = $r_value; } } } } $html = ''; get_header(); ?> <?php if (have_rows('banner')) : while (have_rows('banner')) : the_row(); ?> <div class="header__banner__main"> <div class="header__banner___overlay"></div> <div class="image__box"> <img src="<?php the_sub_field('banner_image'); ?>" alt="Banner" /> </div> <div class="banner__content"> <div class="container-fluid"> <div class="banner__container__inner" style="background-image: url('<?php the_sub_field('banner_background_image'); ?>');"> <h1><?php the_sub_field('banner_heading'); ?></h1> <p><?php the_sub_field('banner_content'); ?></p> <div class="banner__btn__wrapp"> <a class="banner__btn" href="<?php the_sub_field('banner_button_url'); ?>"><?php the_sub_field('banner_button_text'); ?></a> </div> </div> </div> </div> </div> <?php endwhile; endif; ?> <div class="container-fluid"> <div class="marquee"> <div class="marquee__content"> <?php $json_latest = file_get_contents('https://api.kyotounit.com/?action=get_co2_sector_emissions_latest'); $data_latest = json_decode($json_latest, true); if (!empty($data_latest)) { $html .= '<ul class="list-inline">'; foreach ($data_latest as $key => $value) { if (empty($array_all[$value['sector']])) continue; $html .= "<li>"; $html .= "<span class='sector'>" . $value['sector'] . "</span>"; $flag = 0; $kyoto_unit_base_value = $sector_unit_base_value = 0; $kyoto_unit_change = $sector_unit_change = false; $sector_unit_difference = 0; foreach ($array_all[$value['sector']] as $prev_key => $prev_val) { $flag++; if($flag == 1){ $kyoto_unit_base_value = $prev_val->kyoto_unit; //$sector_unit_base_value = $prev_val->sector_unit; $sector_unit_base_value = $value['sector_unit']; continue; } $kyoto_unit_difference = $kyoto_unit_base_value - $prev_val->kyoto_unit; //$sector_unit_difference = $sector_unit_base_value - $prev_val->sector_unit; if(isset($array_all_sector_unit[$value['sector']][$prev_key]->sector_unit) && ($flag <= 3)){ $sector_unit_difference = $sector_unit_base_value - $array_all_sector_unit[$value['sector']][$prev_key]->sector_unit; } if ($kyoto_unit_difference != 0 && !$kyoto_unit_change) { $kyoto_unit_change = true; $sticker = $kyoto_unit_difference > 0 ? 'up' : 'downgreen'; $html .= "<span class='kyoto__unit'>" . $value['kyoto_unit'] . "<img src='//carbonbullion.com/wp-content/uploads/2022/09/" . $sticker . ".png'></span>"; } if ($sector_unit_difference != 0 && !$sector_unit_change && $flag <= 3 ) { $sector_unit_change = true; $sticker = $sector_unit_difference > 0 ? 'up' : 'downgreen'; $html .= "<span class='sector__unit'>" . $value['sector_unit'] . "<img src='//carbonbullion.com/wp-content/uploads/2022/09/" . $sticker . ".png'></span>"; } if ($kyoto_unit_change && $sector_unit_change) break; } if (!$kyoto_unit_change) $html .= "<span class='kyoto__unit'>" . $value['kyoto_unit'] . "<img src='//carbonbullion.com/wp-content/uploads/2022/09/flat-line.png'></span>"; if (!$sector_unit_change) $html .= "<span class='kyoto__unit'>" . $value['sector_unit'] . "<img src='//carbonbullion.com/wp-content/uploads/2022/09/flat-line.png'></span>"; $html .= "</li>"; } } $html .= "</ul>"; echo $html; ?> </div> </div> </div> <div class="body__container__wrapp"> <?php if (have_rows('why_carbon_bullion_section')) : while (have_rows('why_carbon_bullion_section')) : the_row(); ?> <div class="two__col__full__wrapp"> <div class="inner__content__wrap"> <div class="inner__content__holder"> <div class="container-xl"> <div class="row align-items-center"> <div class="col-xl-6 col-lg-6 col-md-6"> <?php the_sub_field('content'); ?> <div class="button__wrapp"> <a href="<?php the_sub_field('button_url'); ?>"> <?php the_sub_field('button_text'); ?> <svg xmlns="http://www.w3.org/2000/svg" width="30.243" height="13.501" viewBox="0 0 30.243 13.501"> <path id="Icon_ionic-ios-arrow-round-down" data-name="Icon ionic-ios-arrow-round-down" d="M24.49,20.784a.919.919,0,0,0-1.294-.007l-4.282,4.268V-1.218A.911.911,0,0,0,18-2.125a.911.911,0,0,0-.914.907V25.045L12.8,20.77a.925.925,0,0,0-1.294.007.91.91,0,0,0,.007,1.287l5.836,5.794h0a1.026,1.026,0,0,0,.288.19.872.872,0,0,0,.352.07.916.916,0,0,0,.64-.26l5.836-5.794A.9.9,0,0,0,24.49,20.784Z" transform="translate(2.125 24.748) rotate(-90)" /> </svg> </a> </div> </div> </div> </div> </div> <div class="image__box"> <img src="<?php the_sub_field('image'); ?>" alt="" /> </div> </div> </div> <?php endwhile; endif; ?> <div class="product__wrapp"> <div class="container-xl"> <?php if (have_rows('our_product_section')) : while (have_rows('our_product_section')) : the_row(); ?> <div class="heading__wrapp"> <h2><?php the_sub_field('heading'); ?></h2> <div class="header__wrapp__inner"> <i class="ico__box"><img src="<?php the_sub_field('line_image'); ?>" alt="" /></i> </div> </div> <?php endwhile; endif; ?> <div class="product__list__main"> <ul> <?php $j = 1; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'post_type' => 'product', 'orderby' => 'date', 'order' => 'DESC', 'posts_per_page' => -1, 'taxonomy' => 'product_cat', 'paged' => $paged ); $products = new WP_Query($args); if ($products->have_posts()) : while ($products->have_posts()) : $products->the_post(); ?> <li class="product__item mr__bottom"> <div class="thumb__wrapper"> <a href="<?php the_permalink(); ?>"> <div class="image__box"> <?php if (has_post_thumbnail($products->post->ID)) echo get_the_post_thumbnail($products->post->ID, 'shop_catalog'); else echo '<img src="' . woocommerce_placeholder_img_src() . '" alt="Placeholder" />'; ?> </div> </a> <a href="<?php the_permalink(); ?>" class="loop__product__link"> <h3 class="product__title"><?php the_title(); ?></h3> </a> <div class="product__descraption"> <?php the_excerpt(); ?> </div> <div class="button__wrapp"> <a href="<?php the_permalink(); ?>">See Details</a> </div> <div class="product__verient"> <?php $product_id = $products->post->ID; $product = wc_get_product($product_id); $variations = $product->get_available_variations(); $variation_spot_price = '0.00'; $i = 1; foreach ($variations as $variation) { // $variation = new WC_Product_Variation($variation['variation_id']); // $variationName = implode(" / ", $variation->get_variation_attributes()); // echo $variationName.'<br />'; $varient_name = ''; if (isset($variation['attributes']['attribute_pa_buy-for']) && $variation['attributes']['attribute_pa_buy-for'] != '') { $varient_name = ucwords(str_replace('-', ' ', $variation['attributes']['attribute_pa_buy-for'])); } if ($i == 1) { $variation_spot_price = $variation['wc_spot_price'] ?? '0.00'; } ?> <label> <input id="coomassie-color<?php echo $variation['variation_id']; ?>" value="<?php echo $variation['variation_id']; ?>" type="radio" name="radio-<?php echo $products->post->ID; ?>" <?php echo ($i == 1) ? 'checked' : ''; ?> data-sprice="$ <?php echo $variation['wc_spot_price'] ?? '0.00'; ?>" data-product="<?php echo $products->post->ID; ?>" /> <span><?php echo $varient_name; ?> <?php echo $variation['variation_description'] ?? ''; ?> </span> </label> <?php $i++; } ?> </div> <div class="product__wrapp__bottom"> <div class="product__quantity"> <input data-min="1000" data-max="0" type="text" name="quantity" value="1000" placeholder="Enter qty"> <div class="quantity__selectors__container"> <div class="quantity__selectors"> <button type="button" class="increment__quantity" aria-label="Add one" data-direction="1"><span>+</span></button> <button type="button" class="decrement__quantity" aria-label="Subtract one" data-direction="1"><span>−</span></button> </div> </div> </div> <a href="#" data-product="<?php echo $products->post->ID; ?>">BUY Now</a> <div class="price__wrapp price__wrapp__spot__price"><span>Spot Price</span> <div class="spot__price spot__price__<?php echo $products->post->ID; ?>">$ <?php echo $variation_spot_price; ?></div> </div> </div> </div> </li> <?php endwhile; endif; wp_reset_query(); ?> </ul> </div> <?php if (have_rows('our_product_section')) : while (have_rows('our_product_section')) : the_row(); ?> <div class="button__wrapp"> <a href="<?php the_sub_field('button_url'); ?>"> <?php the_sub_field('button_text'); ?> <svg xmlns="http://www.w3.org/2000/svg" width="30.243" height="13.501" viewBox="0 0 30.243 13.501"> <path id="Icon_ionic-ios-arrow-round-down" data-name="Icon ionic-ios-arrow-round-down" d="M24.49,20.784a.919.919,0,0,0-1.294-.007l-4.282,4.268V-1.218A.911.911,0,0,0,18-2.125a.911.911,0,0,0-.914.907V25.045L12.8,20.77a.925.925,0,0,0-1.294.007.91.91,0,0,0,.007,1.287l5.836,5.794h0a1.026,1.026,0,0,0,.288.19.872.872,0,0,0,.352.07.916.916,0,0,0,.64-.26l5.836-5.794A.9.9,0,0,0,24.49,20.784Z" transform="translate(2.125 24.748) rotate(-90)"></path> </svg> </a> </div> <?php endwhile; endif; ?> </div> </div> <?php if (have_rows('about_investment_section')) : while (have_rows('about_investment_section')) : the_row(); ?> <div class="full__width__bg" style="background-image: url('<?php the_sub_field('background_image'); ?>');"> <div class="inner__content__wrapp"> <div class="container-xl"> <div class="heading__wrapp"> <h2><?php the_sub_field('heading'); ?></h2> <div class="header__wrapp__inner"> <i class="ico__box"><img src="<?php the_sub_field('line_image'); ?>" alt="" /></i> </div> </div> <?php the_sub_field('content'); ?> <?php if (!empty(the_sub_field('button_url'))) { ?> <div class="button__wrapp"> <a href="<?php the_sub_field('button_url'); ?>"> <?php the_sub_field('button_text'); ?> <svg xmlns="http://www.w3.org/2000/svg" width="30.243" height="13.501" viewBox="0 0 30.243 13.501"> <path id="Icon_ionic-ios-arrow-round-down" data-name="Icon ionic-ios-arrow-round-down" d="M24.49,20.784a.919.919,0,0,0-1.294-.007l-4.282,4.268V-1.218A.911.911,0,0,0,18-2.125a.911.911,0,0,0-.914.907V25.045L12.8,20.77a.925.925,0,0,0-1.294.007.91.91,0,0,0,.007,1.287l5.836,5.794h0a1.026,1.026,0,0,0,.288.19.872.872,0,0,0,.352.07.916.916,0,0,0,.64-.26l5.836-5.794A.9.9,0,0,0,24.49,20.784Z" transform="translate(2.125 24.748) rotate(-90)"></path> </svg> </a> </div> <?php } ?> </div> </div> </div> <?php endwhile; endif; ?> <?php if (have_rows('who_we_serve_section')) : while (have_rows('who_we_serve_section')) : the_row(); ?> <div class="two__col__full__wrapp col__full__wrapp"> <div class="inner__content__wrap"> <div class="inner__content__holder"> <div class="container-xl"> <div class="row align-items-center"> <div class="col-xl-6 col-lg-6 col-md-6"> <?php the_sub_field('content'); ?> </div> </div> </div> </div> <div class="image__box"> <img src="<?php the_sub_field('image'); ?>" alt="" /> </div> </div> </div> <?php endwhile; endif; ?> <?php if (have_rows('steps_carbon_bullion_listing_section')) : while (have_rows('steps_carbon_bullion_listing_section')) : the_row(); ?> <div class="two__col__full__wrapp steps__wrapp"> <div class="container-xl"> <div class="heading__wrapp"> <h2><?php the_sub_field('title'); ?></h2> <div class="header__wrapp__inner"> <i class="ico__box"><img src="<?php the_sub_field('line_image'); ?>" alt="" /></i> </div> <h3><?php the_sub_field('sub_title'); ?></h3> </div> </div> <div class="inner__content__wrap"> <div class="inner__content__holder"> <div class="container-xl"> <div class="row align-items-center"> <div class="col-xl-8 col-lg-8 col-md-10 offset-xl-4 offset-lg-4 offset-md-2"> <div class="steps__list__main"> <div class="steps__items mr__top"> <?php if (have_rows('left_column_content')) : while (have_rows('left_column_content')) : the_row(); ?> <div class="item__wrapp"> <div class="step__item"> <div class="item__number"><?php echo get_sub_field('number'); ?></div> <div class="item__heading"> <h3><?php echo get_sub_field('heading'); ?></h3> </div> </div> <p><?php echo get_sub_field('content'); ?></p> </div> <?php endwhile; endif; ?> </div> <div class="steps__items mr__top"> <?php if (have_rows('right_column_content')) : while (have_rows('right_column_content')) : the_row(); ?> <div class="item__wrapp"> <div class="step__item"> <div class="item__number"><?php echo get_sub_field('number'); ?></div> <div class="item__heading"> <h3><?php echo get_sub_field('heading'); ?></h3> </div> </div> <p><?php echo get_sub_field('content'); ?></p> </div> <?php endwhile; endif; ?> </div> </div> </div> </div> </div> </div> <div class="image__box"> <img src="<?php the_sub_field('image'); ?>" alt="" /> </div> </div> </div> <?php endwhile; endif; ?> <?php if (have_rows('carbon_bullion_sectors_section')) : while (have_rows('carbon_bullion_sectors_section')) : the_row(); ?> <div class="two__col__full__wrapp col__full__wrapp__with__color"> <div class="inner__content__wrap"> <div class="inner__content__holder"> <div class="container-xl"> <div class="row align-items-center"> <div class="col-xl-6 col-lg-6 col-md-6"> <?php the_sub_field('content'); ?> <ul> <?php if (have_rows('bullets')) : while (have_rows('bullets')) : the_row(); ?> <li><i class="ico__box"><img src="<?php echo get_sub_field('icon_image'); ?>" alt="" /></i> <p><?php echo get_sub_field('heading'); ?><span><?php echo get_sub_field('content'); ?></span></p> </li> <?php endwhile; endif; ?> </ul> <?php if (!empty(the_sub_field('button_url'))) { ?> <div class="button__wrapp"> <a href="<?php the_sub_field('button_url'); ?>"> <?php the_sub_field('button_text'); ?> <svg xmlns="http://www.w3.org/2000/svg" width="30.243" height="13.501" viewBox="0 0 30.243 13.501"> <path id="Icon_ionic-ios-arrow-round-down" data-name="Icon ionic-ios-arrow-round-down" d="M24.49,20.784a.919.919,0,0,0-1.294-.007l-4.282,4.268V-1.218A.911.911,0,0,0,18-2.125a.911.911,0,0,0-.914.907V25.045L12.8,20.77a.925.925,0,0,0-1.294.007.91.91,0,0,0,.007,1.287l5.836,5.794h0a1.026,1.026,0,0,0,.288.19.872.872,0,0,0,.352.07.916.916,0,0,0,.64-.26l5.836-5.794A.9.9,0,0,0,24.49,20.784Z" transform="translate(2.125 24.748) rotate(-90)"></path> </svg> </a> </div> <?php } ?> </div> </div> </div> </div> <div class="image__box"> <img src="<?php the_sub_field('image'); ?>" alt="" /> </div> </div> </div> <?php endwhile; endif; ?> <?php if (have_rows('knowledge_section')) : while (have_rows('knowledge_section')) : the_row(); ?> <div class="full__width__bg knowledge__wrapp" style="background-image: url('<?php the_sub_field('background_image'); ?>');"> <div class="inner__content__wrapp"> <div class="container-xl"> <div class="heading__wrapp"> <h2><?php the_sub_field('title'); ?></h2> <div class="header__wrapp__inner"> <i class="ico__box"><img src="<?php the_sub_field('line_image'); ?>" alt="" /></i> </div> </div> <?php the_sub_field('content'); ?> <div class="inner__content__wrapp__inner"> <div class="row m-0"> <div class="col-xl-6 col-lg-6 col-md-6 p-0"> <div class="content__wrapp" style="background-image: url('<?php the_sub_field('second_background_image'); ?>');"> <div class="content__wrapp__inner"> <?php the_sub_field('second_content'); ?> <?php if (!empty(the_sub_field('button_url'))) { ?> <div class="button__wrapp"> <a href="<?php the_sub_field('button_url'); ?>"> <?php the_sub_field('button_text'); ?> <svg xmlns="http://www.w3.org/2000/svg" width="30.243" height="13.501" viewBox="0 0 30.243 13.501"> <path id="Icon_ionic-ios-arrow-round-down" data-name="Icon ionic-ios-arrow-round-down" d="M24.49,20.784a.919.919,0,0,0-1.294-.007l-4.282,4.268V-1.218A.911.911,0,0,0,18-2.125a.911.911,0,0,0-.914.907V25.045L12.8,20.77a.925.925,0,0,0-1.294.007.91.91,0,0,0,.007,1.287l5.836,5.794h0a1.026,1.026,0,0,0,.288.19.872.872,0,0,0,.352.07.916.916,0,0,0,.64-.26l5.836-5.794A.9.9,0,0,0,24.49,20.784Z" transform="translate(2.125 24.748) rotate(-90)"></path> </svg> </a> </div> <?php } ?> </div> </div> </div> <div class="col-xl-6 col-lg-6 col-md-6 p-0"> <div class="image__box"> <img src="<?php the_sub_field('image'); ?>" alt="" /> </div> </div> </div> </div> </div> </div> </div> <?php endwhile; endif; ?> </div> <?php get_footer(); ?>
[-] template-knowledge.php
[edit]
[+]
woocommerce
[-] footer-widget.php
[edit]
[-] search.php
[edit]
[-] template-spot-price copy 1.php
[edit]
[-] index.php
[edit]
[-] page.php
[edit]
[-] searchform.php
[edit]
[+]
..
[-] template-faq.php
[edit]
[-] sidebar.php
[edit]
[-] template-sector.php
[edit]
[-] rtl.css
[edit]
[-] blank-page-with-container.php
[edit]
[-] template-investment.php
[edit]
[-] single.php
[edit]
[-] footer.php
[edit]
[-] template-about.php
[edit]
[-] template-home.php
[edit]
[-] template-spot-price.php
[edit]
[-] .DS_Store
[edit]
[-] template-partner.php
[edit]
[-] blank-page.php
[edit]
[-] left-sidebar.php
[edit]
[-] header.php
[edit]
[-] style.css
[edit]
[-] 404.php
[edit]
[-] readme.txt
[edit]
[-] template-spot-price copy 1.php.zip
[edit]
[-] single-attachment.php
[edit]
[-] woocommerce11.php
[edit]
[-] screenshot.png
[edit]
[-] custom-editor-style.css
[edit]
[-] functions.php
[edit]
[-] archive.php
[edit]
[-] fullwidth.php
[edit]
[+]
template-parts
[-] comments.php
[edit]
[-] template-sponsor.php
[edit]
[-] template-contact.php
[edit]
[+]
inc
[-] template-blog.php
[edit]