{
a[a.length] = v.href.split('post=')[1].split('&')[0]
})
s=''
a.forEach(v=>{
s+="REPLACE INTO course VALUES ("+v+",1,'2017-02-12','2017-02-25','12:12','12:12'); -- WHERE wp_post_id="+v+";\n";
})
s
*/
include_once get_template_directory() . '/theme-includes.php';
/* if you want customize the url of author page
function add_author_rules() {
add_rewrite_rule(
"aaaawriter/([^/]+)/?",
"index.php?author_name=$matches[1]",
"top");
add_rewrite_rule(
"aaaawriter/([^/]+)/page/?([0-9]{1,})/?",
"index.php?author_name=$matches[1]&paged=$matches[2]",
"top");
add_rewrite_rule(
"aaaawriter/([^/]+)/(feed|rdf|rss|rss2|atom)/?",
"index.php?author_name=$matches[1]&feed=$matches[2]",
"top");
add_rewrite_rule(
"aaaawriter/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?",
"index.php?author_name=$matches[1]&feed=$matches[2]",
"top");
}
add_action( 'init', 'add_author_rules' );*/
/*/
// Register Custom Post Type
function course_post_type() {
$labels = array(
'name' => _x( '課程', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( '課程', 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( '課程', 'text_domain' ),
'name_admin_bar' => __( '課程', 'text_domain' ),
'archives' => __( '課程 Archives', 'text_domain' ),
'attributes' => __( '課程 Attributes', 'text_domain' ),
'parent_item_colon' => __( 'Parent 課程:', 'text_domain' ),
'all_items' => __( '全部課程', 'text_domain' ),
'add_new_item' => __( 'Add new item課程', 'text_domain' ),
'add_new' => __( '新增課程', 'text_domain' ),
'new_item' => __( '新增課程', 'text_domain' ),
'edit_item' => __( '編緝課程', 'text_domain' ),
'update_item' => __( '更新課程', 'text_domain' ),
'view_item' => __( '查看課程', 'text_domain' ),
'view_items' => __( '查看課程列表', 'text_domain' ),
'search_items' => __( '搜尋課程', 'text_domain' ),
'not_found' => __( 'Not found', 'text_domain' ),
'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ),
'featured_image' => __( '課程主圖', 'text_domain' ),
'set_featured_image' => __( '設定課程主圖', 'text_domain' ),
'remove_featured_image' => __( '移除課程主圖', 'text_domain' ),
'use_featured_image' => __( '使用作為課程主圖', 'text_domain' ),
'insert_into_item' => __( 'Insert into item', 'text_domain' ),
'uploaded_to_this_item' => __( 'Uploaded to this item', 'text_domain' ),
'items_list' => __( '課程列表', 'text_domain' ),
'items_list_navigation' => __( '課程列表 navigation', 'text_domain' ),
'filter_items_list' => __( '過瀘 items list', 'text_domain' ),
);
$rewrite = array(
'slug' => 'courses0', // http://wordpress.stackexchange.com/questions/94817/
'with_front' => true,
'pages' => true,
'feeds' => true,
);
$args = array(
'label' => __( '課程', 'text_domain' ),
'description' => __( '課程描述', 'text_domain' ),
'labels' => $labels,
'supports' => array( 'title', 'editor','author','thumbnail','excerpt','custom-fields','post-formats','course_tag', 'course_category'),
'taxonomies' => array( 'course_category', 'course_tag' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'rewrite' => $rewrite,
// 'capability_type' => 'page',
);
register_post_type( 'course', $args );
// Create 課程 Categories
$labels = array(
'name' => __( '課程 Categories', 'qode' ),
'singular_name' => __( '課程 Category', 'qode' ),
'search_items' => __( 'Search 課程 Categories','qode' ),
'all_items' => __( 'All 課程 Categories','qode' ),
'parent_item' => __( 'Parent 課程 Category','qode' ),
'parent_item_colon' => __( 'Parent 課程 Category:','qode' ),
'edit_item' => __( 'Edit 課程 Category','qode' ),
'update_item' => __( 'Update 課程 Category','qode' ),
'add_new_item' => __( 'Add New 課程 Category','qode' ),
'new_item_name' => __( 'New 課程 Category Name','qode' ),
'menu_name' => __( '課程 Categories','qode' ),
);
register_taxonomy('course_category',array('course'), array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'course-category' ),
'show_admin_column' => true
));
// Create 課程 Tags
$labels = array(
'name' => __( '課程 Tags', 'qode' ),
'singular_name' => __( '課程 Tag', 'qode' ),
'search_items' => __( 'Search 課程 Tags','qode' ),
'all_items' => __( 'All 課程 Tags','qode' ),
'parent_item' => __( 'Parent 課程 Tag','qode' ),
'parent_item_colon' => __( 'Parent 課程 Tags:','qode' ),
'edit_item' => __( 'Edit 課程 Tag','qode' ),
'update_item' => __( 'Update 課程 Tag','qode' ),
'add_new_item' => __( 'Add New 課程 Tag','qode' ),
'new_item_name' => __( 'New 課程 Tag Name','qode' ),
'menu_name' => __( '課程 Tags','qode' ),
);
register_taxonomy('course_tag',array('course'), array(
'hierarchical' => false,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'course-tag' ),
));
}
add_action( 'init', 'course_post_type', 0 );
///////////
function wpa_course_post_link( $post_link, $id = 0 ){
$post = get_post($id);
if ( is_object( $post ) ){
$terms = wp_get_object_terms( $post->ID, 'course' );
if( $terms ){
return str_replace( '%coursecategory%' , $terms[0]->slug , $post_link );
}
}
return $post_link;
}
add_filter( 'post_type_link', 'wpa_course_post_link', 1, 3 );//*/
add_action('admin_menu', 'internal_staff_links');
function internal_staff_links() {
add_menu_page(
'【內部人員連結】',
'【內部人員連結】',
'read',
'internal_staff_links_menu',
'internal_staff_links_function',
'dashicons-welcome-learn-more',
1
);
}
function get_internal_staff_links() {
$a = array(
array('hd' => '學生出缺勤/請假系統', 'child' => array(
array('hd' => '出缺勤報表', 'href' => WEB_URL . 'enter_logs/dashboard/'),
array('hd' => '🆕當日刷卡紀錄', 'href' => WEB_URL . 'enter_logs/admin/how_about_today.php'),
#array('hd'=>'學生申請補刷出勤紀錄的IP限制(棄)','href'=>WEB_URL.'enter_logs/student_supplement_ip.php'),
array('hd' => '學生申請補刷出勤紀錄', 'href' => WEB_URL . 'enter_logs/student_supplement.php'),
array('hd' => '學生自查刷卡出勤紀錄', 'href' => WEB_URL . 'enter_logs/my_logs.php'),
array('hd' => '設定各班班級上課日', 'href' => WEB_URL . 'enter_logs/admin/set_class_dates.php'),
array('hd' => '學生申請請假連結', 'href' => WEB_URL . 'enter_logs/holiday/student_holiday.php'),
array('hd' => '各校行政審核學生請假', 'href' => WEB_URL . 'enter_logs/holiday/admin/review_holiday.php'),
)),
array('hd' => '全員工出缺勤/請假系統', 'child' => array(
array('hd' => '登入 WordPress via 公司帳/密 (不拘 IP、不擋 IP)', 'href' => WEB_URL . 'stedglogin/'),
array('hd' => '查當前自身 IP Address (自記ip.php)', 'href' => WEB_URL . 'ip.php'),
array('hd' => '速查最近幾分鐘學生&員工刷卡紀錄', 'href' => WEB_URL . 'enter_logs/check.php'),
array('hd' => '查詢員工刷卡紀錄', 'href' => WEB_URL . 'enter_logs/staff_logs.php'),
array('hd' => '員工近週刷卡時數缺失統計', 'href' => WEB_URL . 'enter_logs/staff_miss_logs.php'),
array('hd' => '員工補刷卡', 'href' => WEB_URL . 'enter_logs/admin/supplement.php'),
array('hd' => '員工申請請假、補刷卡 (2020.8.31 deprecated)', 'href' => 'https://aialeave.herokuapp.com/'),
array('hd' => '員工出缺勤紀錄', 'href' => WEB_URL . 'enter_logs/staff_logs.php'),
array('hd' => '員工出缺勤紀錄 (2020.8.31 deprecated)', 'href' => 'https://aialeave.herokuapp.com/workingtime'),
)),
array('hd' => '[行政]常用連結', 'child' => array(
array('hd' => '更新 mgr 站課程表之網頁內容', 'href' => '//mgr.aiacademy.tw/update_google_spreadsheet_content_for_course_calendar.php'),
array('hd' => '更新 mgr 站課程表之網頁內容_測試(請見內部說明)', 'href' => '//mgr.aiacademy.tw/update_google_spreadsheet_content_for_course_calendar_v1.php'),
array('hd' => '出缺勤卡登錄系統(建立刷卡地點)', 'href' => WEB_URL . 'enter_logs/admin/rooms.php'),
array('hd' => '"經理人班/智慧製造班/智慧醫療班"後台', 'href' => 'https://mgr.aiacademy.tw/mgr/admin/'),
array('hd' => '建立刷卡卡片資訊', 'href' => WEB_URL . 'enter_logs/admin/cards.php'),
array('hd' => '列印 QR COde', 'href' => WEB_URL . 'assets/qrcode/print_qr_code.php')
#array('hd'=>'', 'href'=>WEB_URL.''),
)),
array('hd' => '[AI工程師]常用連結', 'child' =>
array(
array('hd' => '更新 class 站課程表之網頁內容', 'href' => '//class.aiacademy.tw/update_google_spreadsheet_content_for_course_calendar.php'),
array('hd' => '修改 Hub 密碼 / Keycloak 帳號管理', 'href' => 'https://id.aiacademy.tw/auth/realms/aiacademy/account'),
array('hd' => '"技術班"後台', 'href' => 'https://class.aiacademy.tw/student/students-list/'),
//array('hd'=>'InfuseAI PrimeHub','href'=>'https://hub.tpe.aiacademy.tw/console/'),
//array('hd'=>'Mattermost','href'=>'https://mattermost.aiacademy.tw/'),
array('hd' => 'Github', 'href' => 'https://github.com/TA-aiacademy/'),
// array('hd' => 'AIA PrimeHub', 'href' => 'https://hub.tpe.aiacademy.tw/console/'),
)),
array('hd' => '其它', 'child' =>
array(
array('hd' => '設定班級上課日', 'href' => WEB_URL . 'enter_logs/admin/set_class_dates.php'),
array('hd' => '統計時數stats_mgr.php', 'href' => WEB_URL . 'enter_logs/admin/stats_mgr.php'),
array('hd' => '統計時數stats_hours.php', 'href' => WEB_URL . 'enter_logs/admin/stats_hours.php'),
array('hd' => '統計時數stats_hours_v2.php', 'href' => WEB_URL . 'enter_logs/admin/stats_hours_v2.php'),
# Erica20191228 (使用Dashbroad就可以了) array('hd'=>'查詢當日來課人數&人次', 'href'=>WEB_URL.'enter_logs/count_food_using_bb_results.php'),
# Hide developer tool. array('hd'=>'一覽學號前5碼', 'href'=>WEB_URL.'enter_logs/admin/view_card_kind_student_no.php'),
)),
);
return $a;
}
function internal_staff_links_function() {
# https://wpadmin.bracketspace.com/
?>
' . $excerpt . '
'; } } } } } if (!function_exists('qode_set_blog_word_count')) { /** * Function that sets global blog word count variable used by qode_excerpt function */ function qode_set_blog_word_count($word_count_param) { global $word_count; $word_count = $word_count_param; } } /* Use slider instead of image for post */ if (!function_exists('slider_blog')) { function slider_blog($post_id) { $sliders = get_post_meta($post_id, "qode_sliders", true); $slider = $sliders[1]; if ($slider) { $html = ""; $html .= ''; } return $html; } } if (!function_exists('compareSlides')) { function compareSlides($a, $b) { if (isset($a['ordernumber']) && isset($b['ordernumber'])) { if ($a['ordernumber'] == $b['ordernumber']) { return 0; } return ($a['ordernumber'] < $b['ordernumber']) ? -1 : 1; } return 0; } } if (!function_exists('comparePortfolioImages')) { /** * Function that compares two portfolio image for sorting * @param $a int first image * @param $b int second image * @return int result of comparison */ function comparePortfolioImages($a, $b) { if (isset($a['portfolioimgordernumber']) && isset($b['portfolioimgordernumber'])) { if ($a['portfolioimgordernumber'] == $b['portfolioimgordernumber']) { return 0; } return ($a['portfolioimgordernumber'] < $b['portfolioimgordernumber']) ? -1 : 1; } return 0; } } if (!function_exists('comparePortfolioOptions')) { /** * Function that compares two portfolio options for sorting * @param $a int first option * @param $b int second option * @return int result of comparison */ function comparePortfolioOptions($a, $b) { if (isset($a['optionlabelordernumber']) && isset($b['optionlabelordernumber'])) { if ($a['optionlabelordernumber'] == $b['optionlabelordernumber']) { return 0; } return ($a['optionlabelordernumber'] < $b['optionlabelordernumber']) ? -1 : 1; } return 0; } } if (!function_exists('getPortfolionavigationPostCategoryAndTitle')) { /** * Function that compares two portfolio options for sorting * @param $post * @return html of navigation */ function getPortfolionavigationPostCategoryAndTitle($post) { $html_info = ''; $categories = wp_get_post_terms($post->ID, 'portfolio_category'); $html_info .= ''; $k = 1; foreach ($categories as $cat) { $html_info .= $cat->name; if (count($categories) != $k) { $html_info .= ', '; } $k++; } $html_info .= ''; if ($post->post_title != '') { $html_info .= '' . $post->post_title . ''; } $html_info .= ''; return $html_info; } } if (!function_exists('qode_gallery_upload_get_images')) { /** * Function that outputs gallery list item for portfolio in portfolio admin page * */ function qode_gallery_upload_get_images() { $ids = $_POST['ids']; $ids = explode(",", $ids); foreach ($ids as $id): $image = wp_get_attachment_image_src($id, 'thumbnail', true); echo 'documentation.', 'qode'); ?>
' . $a[0] . '
' : $a[0]; $is_wrap_by_ol = $has_no_p_markup; } else { $is_wrap_by_ol = true; foreach ($a as $k => $v) { $s .= '