php - Creating a functionality plugin to edit seriously simple podcasting

admin2025-06-03  2

I have made the following change to the below file in Seriously Simple Podcasting Plugin:

/wp-content/plugins/seriously-simple-podcasting/templates/feed-podcast.php

The full file can be found here: .php

// iTunes summary is the full episode content, but must be shorter than 4000 characters
$itunes_summary = mb_substr( $content, 0, 3999 );
$itunes_summary = apply_filters( 'ssp_feed_item_itunes_summary', $itunes_summary, get_the_ID() );
$gp_description = apply_filters( 'ssp_feed_item_gp_description', $itunes_summary, get_the_ID() );

To:

// iTunes summary is the full episode content, but must be shorter than 4000 characters
ob_start();
the_excerpt_rss();
$itunes_summary = mb_substr( ob_get_clean(), 0, 3999 );
$itunes_summary = apply_filters( 'ssp_feed_item_itunes_summary', $itunes_summary, get_the_ID() );
$gp_description = apply_filters( 'ssp_feed_item_gp_description', $itunes_summary, get_the_ID() );

The reason for this is I want the itunes:summary tag in the RSS feed template to pull from the excerpt rather the post content so we can control the itunes summary better.

However I know that doing this will stop me from being able to update the plugin which I don't want and I read about creating a functionality plugin, but I'm unsure on how to create this to edit that file, as I've not done much PHP or playing around with the wordpress code before.

Can anybody assist/advise?

I have made the following change to the below file in Seriously Simple Podcasting Plugin:

/wp-content/plugins/seriously-simple-podcasting/templates/feed-podcast.php

The full file can be found here: https://github/TheCraigHewitt/Seriously-Simple-Podcasting/blob/master/templates/feed-podcast.php

// iTunes summary is the full episode content, but must be shorter than 4000 characters
$itunes_summary = mb_substr( $content, 0, 3999 );
$itunes_summary = apply_filters( 'ssp_feed_item_itunes_summary', $itunes_summary, get_the_ID() );
$gp_description = apply_filters( 'ssp_feed_item_gp_description', $itunes_summary, get_the_ID() );

To:

// iTunes summary is the full episode content, but must be shorter than 4000 characters
ob_start();
the_excerpt_rss();
$itunes_summary = mb_substr( ob_get_clean(), 0, 3999 );
$itunes_summary = apply_filters( 'ssp_feed_item_itunes_summary', $itunes_summary, get_the_ID() );
$gp_description = apply_filters( 'ssp_feed_item_gp_description', $itunes_summary, get_the_ID() );

The reason for this is I want the itunes:summary tag in the RSS feed template to pull from the excerpt rather the post content so we can control the itunes summary better.

However I know that doing this will stop me from being able to update the plugin which I don't want and I read about creating a functionality plugin, but I'm unsure on how to create this to edit that file, as I've not done much PHP or playing around with the wordpress code before.

Can anybody assist/advise?

Share Improve this question asked Jan 28, 2019 at 23:47 Adam BirdsAdam Birds 1033 bronze badges 1
  • have you asked the plugin developer? Can you show the whole function? If it's pluggable it could work. – rudtek Commented Jan 29, 2019 at 0:55
Add a comment  | 

1 Answer 1

Reset to default 1

This is what the ssp_feed_item_itunes_summary filter is for. It lets you change that value through a separate plugin/function. You can read more about filters here.

So rather than making the edit you've made, add a filter to ssp_feed_item_itunes_summary:

function wpse_326975_itunes_summary( $itunes_summary, $post_id ) {
    $itunes_summary = get_the_excerpt( $post_id );

    return $itunes_summary;
}
add_filter( 'ssp_feed_item_itunes_summary', 'wpse_326975_itunes_summary', 10, 2 );
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748966165a315223.html

最新回复(0)