• First of all, thanks for your great plugin! This is a request to re-introduce the ssp_episode_image filter.

    I am working on a site that will host multiple podcasts and courses. Courses behave so differently from ‘ordinary’ podcasts, that I want to use a custom post type (CPT) “unit“ and a custom taxonomy “course” that plays a similar role as SSP’s series taxonomy for that CPT; that is, posts of the type “unit” won’t be assigned a term from SSP’s series taxonomy.

    However, I would also like users to be able to assing ‘album art’ images for the media player per course (i.e., per “course” taxonomy term), rather than only per individual course unit (i.e., per “unit” post). SSP’s Filter Reference mentions a filter ssp_episode_image, and I thought I could use that filter to override the episode image for posts of the type “unit.” But I cannot. I investigated, and it appears to me that the album art image is loaded via SeriouslySimplePodcasting\Repositories\Episode_Repository::get_album_art, and that method does not invoke the ssp_episode_image filter.

    Since you mention that filter in your documentation, I am not sure whether this is a bug, or whether the documentation is simply outdated. Either way, if you could (re-)add a filter that allows to change the album art image shown for a post in the media player, that would be very much appreciated! I would submit a Pull Request, but the GitHub repository is definitely outdated.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter Odin Kroeger

    (@odkr)

    Investigating further, I found the ssp_html_player_data filter. My bad.

    Just in case anybody else encounters a similar issue, this works for me:

    add_filter('ssp_html_player_data', function (array $data): array {
            $src = &$data['album_art']['src'];
            if (preg_match('/no-album-art\.png$/', $src)) {
                try {
                    $episode = new CourseEpisode($data['episode']);
                } catch (WrongPostTypeError $e) {
                    return $data;
                }
    
                $image_id = $episode->getImageID();
                if ($image_id !== null) {
                    $image_src = wp_get_attachment_image_url($image_id);
                    if ($image_src !== false) {
                        $src = $image_src;
                    }
                }
            }
    
            return $data;
        }, 10, 2);
    Plugin Author Serhiy Zakharchenko

    (@zahardoc)

    Hi @odkr,

    Thank you for bringing it to our attention. The filter ssp_episode_image is currently used to show images for episodes, but not for the player because player images should be square while episode images do not have such restrictions.

    You’re right, the ssp_html_player_data filter is what you needed. Anyway, thank you for your question and for sharing the code, we’ll consider adding some more filters there for your convenience.

    Regarding the repository, we’ve moved it to GitLab – https://gitlab.com/castos/Seriously-Simple-Podcasting/-/issues

    Best regards,
    Sergiy, development team.

    Thread Starter Odin Kroeger

    (@odkr)

    Thanks a lot for the reply! And, as far as I am concerned, there is no need for another filter.

    Plugin Author Serhiy Zakharchenko

    (@zahardoc)

    @odkr

    Great, please let me know if you need anything else from our side.

    Best regards,
    Sergiy.

    Plugin Author Serhiy Zakharchenko

    (@zahardoc)

    @odkr

    I added some more PHP filters with our latest plugin version:

    1. ssp_album_art – provides a possibility to change the album art by having a context of the image source and other data:

    add_filter('ssp_album_art', function( $art, $episode_id, $size, $context ){
    	return $art;
    }, 10, 4);
    

    2. ssp_no_album_image – if you just need to change the no album image.

    Best regards,
    Sergiy.

    Thread Starter Odin Kroeger

    (@odkr)

    Thanks a lot!

    Plugin Author Serhiy Zakharchenko

    (@zahardoc)

    @odkr

    My pleasure, please let me know if you need anything else in the future.

    Best regards,
    Sergiy.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Album image in Media Player for Custom Post Type with Custom Taxonomy’ is closed to new replies.