Skip to content

Commit

Permalink
Remove archive and single templates so they live in the theme now.
Browse files Browse the repository at this point in the history
  • Loading branch information
allanhaggett committed Jul 4, 2024
1 parent 63272c4 commit 2527794
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 193 deletions.
147 changes: 0 additions & 147 deletions archive-course.php

This file was deleted.

47 changes: 1 addition & 46 deletions wp-bcgov-corp-learn-portal.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,43 +386,9 @@ function lzone_search_groupby($groupby){
add_filter('posts_groupby', 'lzone_search_groupby');



/**
* Now let's make sure that we're using our own customized template
* so that courses can show the meta data in a customizable fashion.
*
* #TODO extend this to include archive.php for main index page
* and also taxonomy pages
*
*/
function load_course_template( $template ) {
global $post;
if ( 'course' === $post->post_type && locate_template( array( 'single-course.php' ) ) !== $template ) {
/*
* This is a 'course' page
* AND a 'single course template' is not found on
* theme or child theme directories, so load it
* from our plugin directory.
*/
return plugin_dir_path( __FILE__ ) . 'single-course.php';
}
return $template;
}

function course_archive_template( $archive_template ) {
global $post;
if ( is_post_type_archive ( 'course' ) ) {
$archive_template = dirname( __FILE__ ) . '/archive-course.php';
}
return $archive_template;
}

function course_tax_template( $tax_template ) {
global $post;
$tax_template = dirname( __FILE__ ) . '/taxonomy.php';
// if ( is_tax ( 'course_category' ) ) {
// $tax_template = dirname( __FILE__ ) . '/taxonomy.php';
// }
if ( is_tax ( 'learning_partner' ) ) {
$tax_template = dirname( __FILE__ ) . '/taxonomy-learning_partner.php';
}
Expand All @@ -441,16 +407,12 @@ function course_tax_template( $tax_template ) {
if ( is_tax ( 'external_system' ) ) {
$tax_template = dirname( __FILE__ ) . '/taxonomy-external_system.php';
}
if ( is_tax ( 'journey' ) ) {
$tax_template = dirname( __FILE__ ) . '/taxonomy-journey.php';
}
return $tax_template;
}

add_filter( 'single_template', 'load_course_template' );
add_filter( 'archive_template', 'course_archive_template');
add_filter( 'taxonomy_template', 'course_tax_template');


function course_menu() {
add_submenu_page(
'edit.php?post_type=course',
Expand Down Expand Up @@ -1153,13 +1115,6 @@ function expired_courses () {
}


add_action("init", "remove_cron_job");
function remove_cron_job() {
wp_clear_scheduled_hook("course_elm_sync");
}



/* Fire our meta box setup function on the post editor screen. */
add_action( 'load-post.php', 'courses_meta_boxes_setup' );
add_action( 'load-post-new.php', 'courses_meta_boxes_setup' );
Expand Down

0 comments on commit 2527794

Please sign in to comment.