/* Connect fonts and scripts */ function add_styles_and_scripts () { wp_enqueue_style ('font-awesome', get_template_directory_uri() .'/fonts/font-awesome.min.css', array(), '4.4.0' ); wp_enqueue_style ('bootstrap', get_template_directory_uri().'/css/bootstrap.css'); wp_enqueue_style ('bootstrap-modal', get_template_directory_uri().'/css/bootstrap-modal.css'); wp_enqueue_style ('main', get_template_directory_uri() .'/main.css', array(), '1.1' ); wp_enqueue_style ('adaptation', get_template_directory_uri() .'/adaptation.css', array(), '1.4' ); wp_enqueue_script ('boostrap', get_template_directory_uri().'/js/bootstrap.min.js'); wp_enqueue_script ('bootstrap-modal', get_template_directory_uri().'/js/bootstrap-modalmanager.js'); wp_enqueue_script ('main', get_template_directory_uri().'/js/main.js', array(), '1.1'); } add_action( 'wp_enqueue_scripts', 'add_styles_and_scripts' ); /* Connect admin panel customizer */ require get_template_directory() . '/inc/customizer.php'; function get_sections ($sections) { foreach ($sections as $section) { get_template_part( 'sections/section', $section ); } } function get_services () { $query = new WP_Query(array( 'post_type' => "service", 'orderby' => "date", 'order' => "ASC")); $posts = $query->get_posts(); $content = "
"; foreach ($posts as $key=>$post) { $class = ( $key & 1 ) ? "padding-left" : "right-border"; $class1 = ( $key>1) ? "" : "bottom-border"; $price = get_post_meta($post->ID, 'wpcf-price'); $price = array_shift($price); $thumb = get_the_post_thumbnail_url( $post->ID, 'full' ); $description = apply_filters('the_excerpt', get_post_field('post_excerpt', $post->ID)); $content .= " "; } return $content; } function get_address () { return get_theme_mod( "address" ); } function get_open_hours () { return get_theme_mod( "open-hours" ); } function get_email () { return get_theme_mod( "email" ); } function get_map () { $coordinates = get_theme_mod( "coordinates" ); $hint = get_theme_mod( "hint" ); $baloon = get_theme_mod( "baloon" ); $baloon_size = getimagesize($baloon); $baloon_size = str_replace ('width=', '', $baloon_size[3]); $baloon_size = str_replace ('height=', '', $baloon_size); $baloon_size = str_replace ('"', '', $baloon_size); $baloon_size = str_replace (' ', ',', $baloon_size); $width = (int)str_replace (',', '.', $baloon_size); $offset = "-".intval($width/2).",-".$width; echo " "; } add_shortcode( 'email', 'get_email' ); add_shortcode( 'open-hours', 'get_open_hours' ); add_shortcode( 'address', 'get_address' ); add_shortcode( 'main-services', 'get_services' ); add_shortcode( 'map', 'get_map' ); ?> /* Template Name: Main Page */ get_header(); get_sections ( array ( 'header', 'slider', 'services', 'trust_us', 'about', 'how_order', 'why_we', 'licenses', 'coordinates', 'seo', 'modals' )); get_footer(); ?>