• I may simply be misunderstanding the documentation, so please help clarify how this is meant to work.

    In the documentation for the powerpress_player hook, it states that the first param contains the HTML content for the player. Running a simple example, the param seems to return nothing.

    function append_powerpress_player_markup( $content, $media_url, $episode_data) {
        // what is the value of content?
        print $content;
        return $content;
    }
    add_filter( 'powerpress_player', 'append_powerpress_player_markup', 10, 3 );

    The $content param is always null. If I change my Powerpress settings to use the HTML5 player or the MediaElement player, the value is still null.

    I assume this is user error (me) but I am not sure what I am doing wrong or what I should be expecting?

    My primary goal is to inspect the $episode_data for an image and then append that as its own DIV to the player HTML. This is very possible if the $content param had the expected value.

    Any and all help is appreciated!

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author benbeecroft

    (@benbeecroft)

    It seems likely that your code is being executed before PowerPress adds its own callback functions for the player. I would suggest calling add_filter(‘powerpress_player’, …) inside of a wp_loaded callback. This will ensure that PowerPress (as well as other plugins) are fully loaded before your filter gets added.

    function append_powerpress_player_markup( $content, $media_url, $episode_data) { 
        // what is the value of content? 
        print $content; 
        return $content; 
    }
    
    add_action('wp_loaded', function () { 
        add_filter( 'powerpress_player',  append_powerpress_player_markup', 10, 3 );
    }
    Thread Starter yewknee

    (@yewknee)

    Thanks for the tip. I have given it a try and it works as expected. Thank you! $content is no longer null.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘powerpress_player hook expectations’ is closed to new replies.