Skip to content

Commit

Permalink
Merge pull request #195 from mediasanctuary/story-improvements
Browse files Browse the repository at this point in the history
Story improvements
  • Loading branch information
dphiffer authored Nov 27, 2024
2 parents c66068f + fd82dd9 commit b3911e7
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 7 deletions.
80 changes: 80 additions & 0 deletions wp-content/themes/mediasanctuary/acf/group_67471a8d19703.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"key": "group_67471a8d19703",
"title": "HMM Special Episodes",
"fields": [
{
"key": "field_67471a8d5b4cf",
"label": "Special Episode",
"name": "special_episode",
"aria-label": "",
"type": "true_false",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"message": "Special Episode (display with stories)",
"default_value": 0,
"allow_in_bindings": 0,
"ui_on_text": "",
"ui_off_text": "",
"ui": 1
},
{
"key": "field_67471af25b4d2",
"label": "Special Episode Title",
"name": "special_episode_title",
"aria-label": "",
"type": "text",
"instructions": "",
"required": 0,
"conditional_logic": [
[
{
"field": "field_67471a8d5b4cf",
"operator": "==",
"value": "1"
}
]
],
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"maxlength": "",
"allow_in_bindings": 0,
"placeholder": "",
"prepend": "",
"append": ""
}
],
"location": [
[
{
"param": "post_type",
"operator": "==",
"value": "post"
},
{
"param": "post_category",
"operator": "==",
"value": "category:hudson-mohawk-magazine-episodes"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": true,
"description": "",
"show_in_rest": 0,
"modified": 1732713226
}
27 changes: 20 additions & 7 deletions wp-content/themes/mediasanctuary/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,20 @@ function is_story_post($post) {
return true;
}
}
$special_episode = get_field('special_episode', $post);
if (!empty($special_episode)) {
return true;
}
return false;
}

add_filter('the_title', function($title, $post) {
if (get_field('special_episode', $post)) {
return get_field('special_episode_title', $post);
}
return $title;
}, 10, 2);

add_action('pre_get_posts', function($query) {
if ($query->is_main_query() && $query->get('post_type') == 'peoplepower') {
if (empty($_GET['sort']) || $_GET['sort'] == 'recent') {
Expand Down Expand Up @@ -358,13 +369,15 @@ function audio_player() {
$feed_import_link = "<a href=\"$feed_import_link\" class=\"soundcloud-podcast__link\">Listen on SoundCloud</a>";
}

$soundcloud_id = get_post_meta($post->ID, 'soundcloud_podcast_id', true);
if (! empty($soundcloud_id)) {
$sources[] = "/wp-json/soundcloud-podcast/v1/stream/$soundcloud_id";
}
$soundcloud_url = get_post_meta($post->ID, 'soundcloud_podcast_url', true);
if (! empty($soundcloud_url)) {
$soundcloud_link = "<a href=\"$soundcloud_url\" class=\"soundcloud-podcast__link\">Listen on SoundCloud</a>";
if (empty($feed_import_link)) {
$soundcloud_id = get_post_meta($post->ID, 'soundcloud_podcast_id', true);
if (! empty($soundcloud_id)) {
$sources[] = "/wp-json/soundcloud-podcast/v1/stream/$soundcloud_id";
}
$soundcloud_url = get_post_meta($post->ID, 'soundcloud_podcast_url', true);
if (! empty($soundcloud_url)) {
$soundcloud_link = "<a href=\"$soundcloud_url\" class=\"soundcloud-podcast__link\">Listen on SoundCloud</a>";
}
}

$internet_archive_id = get_post_meta($post->ID, 'internet_archive_id', true);
Expand Down

0 comments on commit b3911e7

Please sign in to comment.