fullName; ?>
Mã bệnh nhân: code; ?>
Giới tính: genderDisplay; ?>
Điện thoại: phoneNumber; ?>
Hôn nhân: phoneNumber; ?>
Địa chỉ: address; ?>
Năm sinh: yob; ?>
Email: email; ?>
Nghề nghiệp: job; ?>
(object)$sessions_data);
//var_dump($s_demo->sessions);
thanhgiang_customer_session($s_demo);
$n_demo = (object)array("notices" => (object)array(
(object)array(
"title" => "Thông báo",
"date" => "23/08/2018 15:06",
"link" => "#"),
(object)array(
"title" => "Thông báo",
"date" => "23/08/2018 15:06",
"link" => "#"),
(object)array(
"title" => "Thông báo",
"date" => "23/08/2018 15:06",
"link" => "#")));
thanhgiang_customer_notice($n_demo);
}
}
}
if ( ! function_exists( 'thanhgiang_customer_session' ) ) {
function thanhgiang_customer_session($data) {?>
STT
Phiên khám
Bác sĩ
Thời gian
Kết quả
sessions as $session) { ?>
session; ?>
doctor; ?>
date; ?>
Xem KQ
STT
Tiêu đề
Thời gian gửi
notices as $notice) { ?>
title; ?>
date; ?>
Xem
4, 'cat' => $cateObj->term_id );
$my_posts = new WP_Query( $args );
if($my_posts->have_posts()): ?>
post_title; ?>
post_content; ?>
name ?>
have_posts() ):
$my_posts->the_post();
$ico = get_field('icon_post'); ?>
3, 'cat' => $cateObj->term_id, 'post_status' => 'publish' );
$my_posts = new WP_Query( $args );
if($my_posts->have_posts()): ?>
name ?>
have_posts() ):
$my_posts->the_post();
$date = get_the_date('Y-m-d H:i:s');
?>
2, 'cat' => $cateObj->term_id, 'post_status' => 'publish' );
$my_posts = new WP_Query( $args );
if($my_posts->have_posts()): ?>
name; ?>
have_posts() ):
$my_posts->the_post();
$date = get_the_date('Y-m-d H:i:s'); ?>
'employee',
'tax_query' => array(
array(
'taxonomy' => $taxonomy_name,
'field' => 'term_id',
'terms' => $department->term_id,
'include_children' => false
),
),
'post_status' => 'publish',
'meta_key' => 'order',
'orderby' => 'meta_value',
'order' => 'ASC' );
$my_posts = new WP_Query( $args );
if($my_posts->have_posts()):
while ( $my_posts->have_posts() ):
$my_posts->the_post();
$index=get_the_ID();
?>
'page',
'post_status' => 'publish',
'meta_key' => '_wp_page_template',
'meta_value' => 'templates/education.php',
'order' => 'ASC' );
$my_posts = new WP_Query( $args ); ?>
have_posts()):
while ( $my_posts->have_posts() ):
$my_posts->the_post();
$index=get_the_ID();
?>
$slug,
'container' => '',
'items_wrap' => '',
);
wp_nav_menu( $menu );
}
}
if ( ! function_exists( 'thanhgiang_about_menu' ) ) {
function thanhgiang_about_menu( $slug ) {
$menu = array(
'theme_location' => $slug,
'container' => 'div',
'container_class' => 'content',
'items_wrap' => '
',
);
wp_nav_menu( $menu );
}
}
if ( ! function_exists( 'thanhgiang_footer_menu' ) ) {
function thanhgiang_footer_menu( $slug ) {
$menu = array(
'theme_location' => $slug,
'container' => 'div',
'container_class' => 'col-xs-4 col',
'items_wrap' => '
',
);
wp_nav_menu( $menu );
}
}
if ( !function_exists('thanhgiang_get_first_image') ) {
function thanhgiang_get_first_image() {
global $post, $posts;
$first_img = '';
if (has_post_thumbnail( $post )) {
$first_img = get_the_post_thumbnail_url($post);
}
else {
ob_start();
ob_end_clean();
$output = preg_match_all('/
/i', $post->post_content, $matches);
if(isset($matches [1] [0]))
$first_img = $matches [1] [0];
if(empty($first_img)){ //Defines a default image
//$first_img = get_template_directory_uri() . '/images/default.jpg'; //Duong dan anh mac dinh khi khong tim duoc anh dai dien
$first_img = get_the_post_thumbnail_url($post);
}
if(empty($first_img)){ //Defines a default image
$first_img = get_template_directory_uri() . '/img/default.jpg'; //Duong dan anh mac dinh khi khong tim duoc anh dai dien
}
}
return $first_img;
}
}
/**
@ Hàm hiển thị ảnh thumbnail của post.
@ Ảnh thumbnail sẽ không được hiển thị trong trang single
@ Nhưng sẽ hiển thị trong single nếu post đó có format là Image
@ thanhgiang_thumbnail( $size )
**/
if ( ! function_exists( 'thanhgiang_thumbnail' ) ) {
function thanhgiang_thumbnail( $size ) {
// Chỉ hiển thumbnail với post không có mật khẩu
if ( ! is_single() && has_post_thumbnail() && ! post_password_required() || has_post_format( 'image' ) ) : ?>
ở trang single
@ Còn ở trang chủ và trang lưu trữ, nó sẽ là thẻ
@ thanhgiang_entry_header()
**/
if ( ! function_exists( 'thanhgiang_entry_header' ) ) {
function thanhgiang_entry_header() {
if ( is_single() ) : ?>
';
// Hiển thị tên tác giả, tên category và ngày tháng đăng bài
printf( __('Post in %1$s', 'thanhgiang'),
get_the_category_list( ', ' ) );
// printf( __(' Our Blog by %1$s ', 'thanhgiang'),
// get_the_author(), get_the_author_link() );
// Hiển thị số đếm lượt bình luận
// if ( comments_open() ) :
// echo ' | ';
// comments_popup_link(
// __('Leave a comment', 'thanhgiang'),
// __('1 comment', 'thanhgiang'),
// __('% comments', 'thanhgiang'),
// __('Read all comments', 'thanhgiang')
// );
// echo ' ';
// endif;
echo '';
endif;
}
}
/**
@ Hàm hiển thị nội dung của post type
@ Hàm này sẽ hiển thị đoạn rút gọn của post ngoài trang chủ (the_excerpt)
@ Nhưng nó sẽ hiển thị toàn bộ nội dung của post ở trang single (the_content)
@ thanhgiang_entry_content()
**/
if ( ! function_exists( 'thanhgiang_entry_content' ) ) {
function thanhgiang_entry_content() {
if ( ! is_single() && ! is_page() ) :
the_excerpt();
else :
the_content();
/*
* Code hiển thị phân trang trong post type
*/
$link_pages = array(
'before' => __(' Page:', 'thanhgiang'),
'after' => '
',
'nextpagelink' => __( 'Next page', 'thanhgiang' ),
'previouspagelink' => __( 'Previous page', 'thanhgiang' )
);
wp_link_pages( $link_pages );
endif;
}
}
/**
@ Hàm hiển thị info ở trang chủ
**/
if ( !function_exists( 'thanhgiang_info' ) ){
function thanhgiang_info( $id ){
while ( have_posts() ) : the_post();
if ( get_post($id) ) :
$page = get_post($id);
echo $page->post_content;
endif;
endwhile;
}
}
/**
@ Hàm hiển thị tag của post
@ thanhgiang_entry_tag()
**/
if ( ! function_exists( 'thanhgiang_entry_tag' ) ) {
function thanhgiang_entry_tag() {
if ( has_tag() ) :
echo '';
printf( __('Tagged in %1$s', 'thanhgiang'), get_the_tag_list( '', ', ' ) );
echo '
';
endif;
}
}
function thanhgiang_set_post_views($postID) {
$count_key = 'tg_post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
$count = 0;
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
}else{
$count++;
update_post_meta($postID, $count_key, $count);
}
}
//To keep the count accurate, lets get rid of prefetching
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
function thanhgiang_get_post_views($postID){
$count_key = 'tg_post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
return "0 View";
}
return $count.' Views';
}
function thanhgiang_numeric_posts_nav() {
if( is_singular() )
return;
global $wp_query;
/** Stop execution if there's only 1 page */
if( $wp_query->max_num_pages <= 1 )
return;
$paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1;
$max = intval( $wp_query->max_num_pages );
/** Add current page to the array */
if ( $paged >= 1 )
$links[] = $paged;
/** Add the pages around the current page to the array */
if ( $paged >= 3 ) {
$links[] = $paged - 1;
$links[] = $paged - 2;
}
if ( ( $paged + 2 ) <= $max ) {
$links[] = $paged + 2;
$links[] = $paged + 1;
}
echo '' . "\n";
}
if( ! function_exists( 'the_paginate' ) ) :
function the_paginate($args = null) {
$defaults = array(
'title' => 'Pages',
'query' => null
);
$args = wp_parse_args($args, $defaults);
extract($args, EXTR_SKIP);
if(is_404()) {
return;
}
$currentPage = null;
$totalPage = null;
if(empty($query)) {
global $wp_query;
$query = $wp_query;
}
$currentPage = stheme_get_paged();
$title .= ':';
$ppp = intval($query->query_vars['posts_per_page']);
if($ppp < 1) {
return;
}
$totalPage = intval(ceil($query->found_posts / $ppp));
if($totalPage <= 1) {
return;
}
$paginateResult = ''.$title.' ';
if ($currentPage > 1) {
$paginateResult .= '
« ';
}
$paginateResult .= the_paginate_list(1, $totalPage, $currentPage);
if ($currentPage < $totalPage) {
$paginateResult .= "
» ";
}
$paginateResult .= "
";
echo $paginateResult;
}
endif;
if( ! function_exists( 'stheme_paginate' ) ) :
function stheme_paginate($args = null) {
the_paginate($args);
}
endif;
if( ! function_exists( 'the_paginate_list' ) ) :
function the_paginate_list($intStart, $totalPage, $currentPage) {
$pageHidden = '... ';
$linkResult = "";
$hiddenBefore = false;
$hiddenAfter = false;
for ($i = $intStart; $i <= $totalPage; $i++) {
if($currentPage === intval($i)) {
$linkResult .= ''.$i.' ';
}
else if(($i <= 6 && $currentPage < 10) || $i == $totalPage || $i == 1 || $i < 4 || ($i <= 6 && $totalPage <= 6) || ($i > $currentPage && ($i <= ($currentPage + 2))) || ($i < $currentPage && ($i >= ($currentPage - 2))) || ($i >= ($totalPage - 2) && $i < $totalPage)) {
$linkResult .= ''.$i.' ';
if($i <= 6 && $currentPage < 10) {
$hiddenBefore = true;
}
}
else {
if(!$hiddenBefore) {
$linkResult .= $pageHidden;
$hiddenBefore = true;
}
else if(!$hiddenAfter && $i > $currentPage) {
$linkResult .= $pageHidden;
$hiddenAfter = true;
}
}
}
return $linkResult;
}
endif;
function stheme_get_paged() {
$paged = intval(get_query_var('paged')) ? intval(get_query_var('paged')) : 1;
return $paged;
}
function tao_custom_post_type()
{
$label = array(
'name' => __('Employees','thanhgiang'),
'singular_name' => __('Employee','thanhgiang')
);
$args = array(
'labels' => $label, //Gọi các label trong biến $label ở trên
'description' => 'Employee', //Mô tả của post type
'supports' => array(
'title',
'editor',
'excerpt',
'custom-fields'
), //Các tính năng được hỗ trợ trong post type
'hierarchical' => false, //Cho phép phân cấp, nếu là false thì post type này giống như Post, false thì giống như Page
'public' => true, //Kích hoạt post type
'show_ui' => true, //Hiển thị khung quản trị như Post/Page
'show_in_menu' => true, //Hiển thị trên Admin Menu (tay trái)
'show_in_nav_menus' => true, //Hiển thị trong Appearance -> Menus
'show_in_admin_bar' => true, //Hiển thị trên thanh Admin bar màu đen.
'menu_position' => 5, //Thứ tự vị trí hiển thị trong menu (tay trái)
'menu_icon' => 'dashicons-admin-users', //Đường dẫn tới icon sẽ hiển thị
'can_export' => true, //Có thể export nội dung bằng Tools -> Export
'has_archive' => false, //Cho phép lưu trữ (month, date, year)
'exclude_from_search' => false, //Loại bỏ khỏi kết quả tìm kiếm
'publicly_queryable' => true, //Hiển thị các tham số trong query, phải đặt true
'capability_type' => 'post' //
);
register_post_type('employee', $args);
}
add_action('init', 'tao_custom_post_type');
function tao_taxonomy() {
/* Biến $label chứa các tham số thiết lập tên hiển thị của Taxonomy
*/
$labels = array(
'name' => __('Departments','thanhgiang'),
'singular' => __('Department','thanhgiang'),
'menu_name' => __('Departments','thanhgiang')
);
/* Biến $args khai báo các tham số trong custom taxonomy cần tạo
*/
$args = array(
'labels' => $labels,
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'show_tagcloud' => true,
);
/* Hàm register_taxonomy để khởi tạo taxonomy
*/
register_taxonomy('department', array('employee'), $args);
}
// Hook into the 'init' action
add_action( 'init', 'tao_taxonomy', 0 );
function add_query_vars_filter( $vars ) {
$vars[] = "dep";
return $vars;
}
add_filter( 'query_vars', 'add_query_vars_filter' );
/**
@ Chèn CSS và Javascript vào theme
@ sử dụng hook wp_enqueue_scripts() để hiển thị nó ra ngoài front-end
**/
function thanhgiang_styles() {
/*
* Hàm get_stylesheet_uri() sẽ trả về giá trị dẫn đến file style.css của theme
* Nếu sử dụng child theme, thì file style.css này vẫn load ra từ theme mẹ
*/
wp_register_style( 'plugin-style', get_template_directory_uri() . '/css/plugin.css', 'all' );
wp_enqueue_style( 'plugin-style' );
wp_register_style( 'main-style', get_template_directory_uri() . '/css/main.css?v='.time(), 'all' );
wp_enqueue_style( 'main-style' );
wp_register_script( 'plugin-js', get_template_directory_uri() . '/js/plugin.js', array('jquery'),null,true );
wp_enqueue_script( 'plugin-js' );
wp_enqueue_script('params-js', get_template_directory_uri() . '/js/test.js');
wp_localize_script( 'params-js', 'my_ajax_object',array( 'ajax_url' => admin_url( 'admin-ajax.php' ),'siteurl' => get_option('siteurl') ));
wp_enqueue_script( 'params-js' );
wp_register_script( 'map-js', get_template_directory_uri() . '/js/map.js', array('jquery'),null,true );
wp_enqueue_script( 'map-js' );
wp_register_script( 'knockout-js', get_template_directory_uri() . '/js/knockout-3.4.2.js', array('jquery'),null,true );
wp_enqueue_script( 'knockout-js' );
wp_register_script( 'knockout-mapping-js', get_template_directory_uri() . '/js/knockout.mapping-latest.js', array('jquery') ,null,true);
wp_enqueue_script( 'knockout-mapping-js' );
wp_register_script( 'knockout-validation-js', get_template_directory_uri() . '/js/knockout.validation.min.js', array('jquery') ,null,true);
wp_enqueue_script( 'knockout-validation-js' );
wp_register_script( 'moment-js', get_template_directory_uri() . '/js/moment.min.js', array('jquery'),null,true );
wp_enqueue_script( 'moment-js' );
wp_register_script( 'bootstrap-datepicker-js', get_template_directory_uri() . '/js/bootstrap-datepicker.min.js', array('jquery'),null,true );
wp_enqueue_script( 'bootstrap-datepicker-js' );
wp_register_script( 'carousel-js', get_template_directory_uri() . '/js/owl.carousel.js', array('jquery'),null,true );
wp_enqueue_script( 'carousel-js' );
wp_register_script( 'main-js', get_template_directory_uri() . '/js/main.js', array('jquery'),null,true );
wp_enqueue_script( 'main-js' );
}
add_action( 'wp_enqueue_scripts', 'thanhgiang_styles' );
function booking_styles() {
wp_register_style('booking', get_template_directory_uri() . '/css/bootstrap-datepicker3.min.css', 'all');
$id = pll_get_post( 171 );
if(is_page($id)){
wp_enqueue_style('booking');
}}
add_action( 'wp_enqueue_scripts', 'booking_styles' );
//add fix
add_action( 'wp_enqueue_scripts', 'booking_styles' );
add_action( 'wp_enqueue_scripts', 'touchSwipe' );
function touchSwipe() {
$time = current_time( 'YmdHis' );
// // javascript
wp_enqueue_script('my-script', get_template_directory_uri() . '/js/jquery.touchSwipe.min.js?', array('jquery'), $time, true );
}