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(
* The Audiothek uses ACF to generate custom fields, including the field
* for selecting the course that a lesson belongs to. Hence, an ACF filter
* 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
* counter cannot be incremented. To fix this, the filter below links
* lessons to their courses right after the lesson has been saved.
* BEFORE the lesson is linked to the course it belongs to, to the effect
* that the counter is NOT incremented. To fix this, the filter below
* links lessons to their courses right after the lesson has been saved,
* which is BEFORE the ACF filter runs.
*/
add_action(
hook_name: 'save_post_' . CPT_LESSON,
......@@ -64,12 +65,7 @@ add_action(
$course = $acf[FLD_COURSE];
$term_id = (int) sanitize_text_field($course);
if ($term_id !== 0) {
wp_set_object_terms(
$post_id,
$term_id,
TAX_COURSE,
false
);
wp_set_object_terms($post_id, $term_id, TAX_COURSE, false);
}
}
}
......
This diff is collapsed.
......@@ -90,7 +90,7 @@ const TAX_SPEAKER = 'speaker';
/* Name of the tags taxonomy (provided by WordPress core). */
const TAX_TAGS = 'tags';
/* Name of series taxonomy. */
/* Name of series taxonomy (provided by SSP). */
define('TAX_SERIES', ssp_series_slug());
......@@ -142,3 +142,4 @@ const FLD_SEMESTER = PREFIX . TAX_SEMESTER;
/* Name of speakers metadata field. */
const FLD_SPEAKERS = PREFIX . TAX_SPEAKER;
......@@ -24,7 +24,7 @@ register_post_type(
'taxonomies' => [
TAX_COURSE,
TAX_CLASSIFICATION,
TAX_MIGRATION,
TAX_MIGRATION,
TAX_SPEAKER,
TAX_TAGS,
TAX_SEMESTER
......
......@@ -41,27 +41,28 @@ register_taxonomy(
/* Philosophical fragments format. */
register_taxonomy(
taxonomy: TAX_FORMAT,
object_type: SSP_CPT_PODCAST,
args: [
'labels' => labels_derive(
singular: esc_html_x(
'Episode Type',
'taxonomy singular name',
'audiothek'
),
plural: esc_html_x(
'Episode Types',
'taxonomy plural name',
'audiothek'
),
),
'meta_box_cb' => false,
'show_in_rest' => false,
'show_admin_column' => true,
]
);
# No longer in use. Left here temporarily. FIXME
# register_taxonomy(
# taxonomy: TAX_FORMAT,
# object_type: SSP_CPT_PODCAST,
# args: [
# 'labels' => labels_derive(
# singular: esc_html_x(
# 'Episode Type',
# 'taxonomy singular name',
# 'audiothek'
# ),
# plural: esc_html_x(
# 'Episode Types',
# 'taxonomy plural name',
# 'audiothek'
# ),
# ),
# 'meta_box_cb' => false,
# 'show_in_rest' => false,
# 'show_admin_column' => true,
# ]
# );
/* 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