<?php get_header(); // Start the loop. while (have_posts()) { the_post(); if ($children = artempol_children_pages(get_the_id())) { $children_list = ''; foreach ($children as $post) { $children_list .= artempol_get_post($post, 'list', array('link')); } $children = artempol_container(array('tag' => 'ul', 'content' => $children_list)); echo $children; } if ($content = apply_filters('the_content', get_the_content())) { $content = artempol_container(array('tag' => 'div', 'content' => $content, 'class' => 'content')); echo $content; } // Departments pages if ($term = get_term_by('slug', $post->post_name, 'department')) { $doctors = ''; $questions = ''; $col_1 = ''; $col_2 = ''; $dep_content = ''; $questions_heading = ''; $doctors .= artempol_get_posts('doctor', array('post_type' => 'doctor', 'tax_query' => array(array('taxonomy' => 'department', 'field' => 'slug', 'terms' => $term->slug))), array('image', 'title', 'descriprion', 'content')); $questions .= artempol_get_posts('question', array('post_type' => 'question', 'tax_query' => array(array('taxonomy' => 'department', 'field' => 'slug', 'terms' => $term->slug))), array('title', 'description', 'content', 'edit_link')); if ($questions) { $questions = artempol_container(array('tag' => 'h2', 'content' => __('Questions', 'artempol'))) . $questions; }
} if ($achievements) { $achievements = artempol_container(array('tag' => 'ul', 'content' => $achievements, 'class' => 'slides')); $achievements = artempol_container(array('tag' => 'div', 'content' => $achievements, 'class' => 'slider-achieve flexslider wow fadeInUp')); $achievements = artempol_container(array(), 'line') . $achievements; echo $achievements; } // Services $services = get_post(get_theme_mod('services-page')); if ($services) { $services = artempol_get_post($services, 'services', array('title', 'content')); echo $services; } // Team $doctors = artempol_get_posts('team', array('post_type' => 'doctor'), array('url', 'image', 'title', 'description')); if ($doctors) { $doctors = artempol_container(array('tag' => 'div', 'content' => $doctors, 'class' => 'content_wrap clearfix padding_tb_10 wow fadeInUp'), 'slider-team'); $headings = ''; $headings .= artempol_container(array('tag' => 'h2', 'content' => __('Our team', 'artempol'))); $headings .= artempol_container(array('tag' => 'p', 'content' => __('Because we care!', 'artempol'))); $doctors = artempol_container(array('tag' => 'div', 'content' => $headings . $doctors, 'class' => 'team wow fadeInUp')); $doctors = artempol_container(array(), 'line') . $doctors; echo $doctors; } // Banners $banners = get_posts(array('category_name' => 'banners')); if (!empty($banners)) { echo artempol_get_post($banners[0], 'banner', array('title', 'content')); } // Footer get_footer();
function artempol_get_posts($template, $args, $tags) { $defaults = array('posts_per_page' => 10, 'offset' => 0, 'category' => '', 'category_name' => '', 'orderby' => 'date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'post', 'post_mime_type' => '', 'post_parent' => '', 'author' => '', 'post_status' => 'publish', 'suppress_filters' => true); $args = wp_parse_args($args, $defaults); if ($posts = get_posts($args)) { $counter = 0; $buffer = ''; $output = ''; $count_posts = count($posts); foreach ($posts as $obj_post) { $counter++; $tags['counter'] = $counter; $buffer .= artempol_get_post($obj_post, $template, $tags); } $output = $buffer; return $output; } else { return false; } }