Skip to content
Snippets Groups Projects
Unverified Commit df83da05 authored by Odin Kroeger's avatar Odin Kroeger
Browse files

style: Various minor changes

parent 5a61f002
No related branches found
No related tags found
No related merge requests found
...@@ -51,9 +51,10 @@ add_action( ...@@ -51,9 +51,10 @@ add_action(
* The Audiothek uses ACF to generate custom fields, including the field * The Audiothek uses ACF to generate custom fields, including the field
* for selecting the course that a lesson belongs to. Hence, an ACF filter * for selecting the course that a lesson belongs to. Hence, an ACF filter
* is used to count lessons automagically. However, that filter is run * is used to count lessons automagically. However, that filter is run
* BEFORE the lesson is linked to the course it belongs to, so that the * BEFORE the lesson is linked to the course it belongs to, to the effect
* counter cannot be incremented. To fix this, the filter below links * that the counter is NOT incremented. To fix this, the filter below
* lessons to their courses right after the lesson has been saved. * links lessons to their courses right after the lesson has been saved,
* which is BEFORE the ACF filter runs.
*/ */
add_action( add_action(
hook_name: 'save_post_' . CPT_LESSON, hook_name: 'save_post_' . CPT_LESSON,
...@@ -64,12 +65,7 @@ add_action( ...@@ -64,12 +65,7 @@ add_action(
$course = $acf[FLD_COURSE]; $course = $acf[FLD_COURSE];
$term_id = (int) sanitize_text_field($course); $term_id = (int) sanitize_text_field($course);
if ($term_id !== 0) { if ($term_id !== 0) {
wp_set_object_terms( wp_set_object_terms($post_id, $term_id, TAX_COURSE, false);
$post_id,
$term_id,
TAX_COURSE,
false
);
} }
} }
} }
......
This diff is collapsed.
...@@ -90,7 +90,7 @@ const TAX_SPEAKER = 'speaker'; ...@@ -90,7 +90,7 @@ const TAX_SPEAKER = 'speaker';
/* Name of the tags taxonomy (provided by WordPress core). */ /* Name of the tags taxonomy (provided by WordPress core). */
const TAX_TAGS = 'tags'; const TAX_TAGS = 'tags';
/* Name of series taxonomy. */ /* Name of series taxonomy (provided by SSP). */
define('TAX_SERIES', ssp_series_slug()); define('TAX_SERIES', ssp_series_slug());
...@@ -142,3 +142,4 @@ const FLD_SEMESTER = PREFIX . TAX_SEMESTER; ...@@ -142,3 +142,4 @@ const FLD_SEMESTER = PREFIX . TAX_SEMESTER;
/* Name of speakers metadata field. */ /* Name of speakers metadata field. */
const FLD_SPEAKERS = PREFIX . TAX_SPEAKER; const FLD_SPEAKERS = PREFIX . TAX_SPEAKER;
...@@ -24,7 +24,7 @@ register_post_type( ...@@ -24,7 +24,7 @@ register_post_type(
'taxonomies' => [ 'taxonomies' => [
TAX_COURSE, TAX_COURSE,
TAX_CLASSIFICATION, TAX_CLASSIFICATION,
TAX_MIGRATION, TAX_MIGRATION,
TAX_SPEAKER, TAX_SPEAKER,
TAX_TAGS, TAX_TAGS,
TAX_SEMESTER TAX_SEMESTER
......
...@@ -41,27 +41,28 @@ register_taxonomy( ...@@ -41,27 +41,28 @@ register_taxonomy(
/* Philosophical fragments format. */ /* Philosophical fragments format. */
register_taxonomy( # No longer in use. Left here temporarily. FIXME
taxonomy: TAX_FORMAT, # register_taxonomy(
object_type: SSP_CPT_PODCAST, # taxonomy: TAX_FORMAT,
args: [ # object_type: SSP_CPT_PODCAST,
'labels' => labels_derive( # args: [
singular: esc_html_x( # 'labels' => labels_derive(
'Episode Type', # singular: esc_html_x(
'taxonomy singular name', # 'Episode Type',
'audiothek' # 'taxonomy singular name',
), # 'audiothek'
plural: esc_html_x( # ),
'Episode Types', # plural: esc_html_x(
'taxonomy plural name', # 'Episode Types',
'audiothek' # 'taxonomy plural name',
), # 'audiothek'
), # ),
'meta_box_cb' => false, # ),
'show_in_rest' => false, # 'meta_box_cb' => false,
'show_admin_column' => true, # 'show_in_rest' => false,
] # 'show_admin_column' => true,
); # ]
# );
/* Special taxonomy for data migration. */ /* Special taxonomy for data migration. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment