Commit realizado el 12:13:52 08-04-2024
This commit is contained in:
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
/**
|
||||
* Add Podcasts RSS feed.
|
||||
*
|
||||
* @since 3.0.17
|
||||
* @package RankMath
|
||||
* @subpackage RankMathPro\Schema
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
namespace RankMathPro\Podcast;
|
||||
|
||||
use RankMath\Helper;
|
||||
use RankMath\Traits\Hooker;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Media_RSS class.
|
||||
*/
|
||||
class Podcast_RSS {
|
||||
|
||||
use Hooker;
|
||||
|
||||
/**
|
||||
* The Constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
$prefix = 'rss2_podcast';
|
||||
if ( apply_filters( 'rank_math/podcast/enhance_all_feeds', true ) ) {
|
||||
$prefix = 'rss2';
|
||||
}
|
||||
|
||||
remove_action( 'rss2_head', 'rss2_site_icon' );
|
||||
$this->action( "{$prefix}_ns", 'add_namespace' );
|
||||
$this->action( "{$prefix}_head", 'add_channel_data' );
|
||||
$this->action( "{$prefix}_item", 'add_podcast_data', 10, 1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add namespace to RSS feed.
|
||||
*/
|
||||
public function add_namespace() {
|
||||
if ( apply_filters( 'rank_math/rss/add_podcasts_namespace', true ) ) {
|
||||
echo 'xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" ';
|
||||
}
|
||||
|
||||
$this->filter( 'get_wp_title_rss', 'feed_title' );
|
||||
$this->filter( 'bloginfo_rss', 'feed_description', 10, 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the feed title.
|
||||
*
|
||||
* @param string $wp_title_rss The current blog title.
|
||||
*/
|
||||
public function feed_title( $wp_title_rss ) {
|
||||
$podcast_title = Helper::get_settings( 'general.podcast_title' );
|
||||
if ( $podcast_title ) {
|
||||
return Helper::replace_vars( $podcast_title );
|
||||
}
|
||||
|
||||
return $wp_title_rss;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the feed description.
|
||||
*
|
||||
* @param string $value RSS container for the blog information.
|
||||
* @param string $show The type of blog information to retrieve.
|
||||
*/
|
||||
public function feed_description( $value, $show ) {
|
||||
if ( 'description' !== $show ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
$podcast_description = Helper::get_settings( 'general.podcast_description' );
|
||||
if ( $podcast_description ) {
|
||||
return Helper::replace_vars( $podcast_description );
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Podcast channel data
|
||||
*/
|
||||
public function add_channel_data() {
|
||||
$category = Helper::get_settings( 'general.podcast_category' );
|
||||
if ( $category ) {
|
||||
$this->newline( '<itunes:category text="' . esc_attr( $category ) . '" />', 1 );
|
||||
}
|
||||
|
||||
$author_name = Helper::get_settings( 'general.podcast_owner' );
|
||||
$author_email = Helper::get_settings( 'general.podcast_owner_email' );
|
||||
if ( $author_email ) {
|
||||
$this->newline( '<itunes:author>' . esc_html( $author_name ) . '</itunes:author>', 1 );
|
||||
$this->newline( '<itunes:owner>', 1 );
|
||||
if ( $author_email ) {
|
||||
$this->newline( '<itunes:name>' . esc_html( $author_name ) . '</itunes:name>', 2 );
|
||||
}
|
||||
$this->newline( '<itunes:email>' . esc_html( $author_email ) . '</itunes:email>', 2 );
|
||||
$this->newline( '</itunes:owner>', 1 );
|
||||
}
|
||||
|
||||
$image = Helper::get_settings( 'general.podcast_image' );
|
||||
if ( $image ) {
|
||||
$this->newline( '<itunes:image href="' . esc_url( $image ) . '" />', 1 );
|
||||
$this->newline( '<image>', 1 );
|
||||
$this->newline( '<title>' . get_wp_title_rss() . '</title>', 2 );
|
||||
$this->newline( '<url>' . esc_url( $image ) . '</url>', 2 );
|
||||
$this->newline( '<link>' . get_bloginfo_rss( 'url' ) . '</link>', 2 );
|
||||
$this->newline( '</image>', 1 );
|
||||
}
|
||||
|
||||
$title = Helper::get_settings( 'general.podcast_title' );
|
||||
if ( $title ) {
|
||||
$this->newline( '<itunes:subtitle>' . esc_html( Helper::replace_vars( $title ) ) . '</itunes:subtitle>', 1 );
|
||||
}
|
||||
|
||||
$summary = Helper::get_settings( 'general.podcast_description' );
|
||||
if ( $summary ) {
|
||||
$this->newline( '<itunes:summary>' . esc_html( Helper::replace_vars( $summary ) ) . '</itunes:summary>', 1 );
|
||||
}
|
||||
|
||||
$is_explicit = Helper::get_settings( 'general.podcast_explicit' ) ? 'yes' : 'clean';
|
||||
$this->newline( '<itunes:explicit>' . $is_explicit . '</itunes:explicit>', 1 );
|
||||
|
||||
$copyright = Helper::get_settings( 'general.podcast_copyright_text' );
|
||||
if ( $copyright ) {
|
||||
$copyright = str_replace( '©', '©', $copyright );
|
||||
$this->newline( '<copyright>' . esc_html( $copyright ) . '</copyright>', 1 );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Podcast Data in RSS feed.
|
||||
*
|
||||
* @see https://support.google.com/podcast-publishers/answer/9889544
|
||||
* @see https://podcasters.apple.com/support/823-podcast-requirements
|
||||
*/
|
||||
public function add_podcast_data() {
|
||||
global $post;
|
||||
$podcast = get_post_meta( $post->ID, 'rank_math_schema_PodcastEpisode', true );
|
||||
if ( empty( $podcast ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$title = ! empty( $podcast['name'] ) ? Helper::replace_vars( $podcast['name'], $post ) : '';
|
||||
$description = ! empty( $podcast['description'] ) ? Helper::replace_vars( $podcast['description'], $post ) : '';
|
||||
$audio_file = $podcast['associatedMedia']['contentUrl'];
|
||||
$duration = ! empty( $podcast['timeRequired'] ) ? Helper::duration_to_seconds( $podcast['timeRequired'] ) : '';
|
||||
$image = ! empty( $podcast['thumbnailUrl'] ) ? Helper::replace_vars( $podcast['thumbnailUrl'], $post ) : '';
|
||||
$author = ! empty( $podcast['author'] ) ? Helper::replace_vars( $podcast['author']['name'], $post ) : '';
|
||||
$is_explicit = empty( $podcast['isFamilyFriendly'] ) ? 'yes' : 'clean';
|
||||
$episode_number = ! empty( $podcast['episodeNumber'] ) ? $podcast['episodeNumber'] : '';
|
||||
$season_number = ! empty( $podcast['partOfSeason'] ) && ! empty( $podcast['partOfSeason']['seasonNumber'] ) ? $podcast['partOfSeason']['seasonNumber'] : '';
|
||||
|
||||
if ( $title ) {
|
||||
$this->newline( '<itunes:title>' . wp_kses_post( $title ) . '</itunes:title>' );
|
||||
}
|
||||
|
||||
if ( $description ) {
|
||||
$this->newline( '<itunes:summary>' . wp_kses_post( $description ) . '</itunes:summary>', 2 );
|
||||
}
|
||||
|
||||
if ( $image ) {
|
||||
$this->newline( '<itunes:image href="' . esc_url( $image ) . '" />', 2 );
|
||||
}
|
||||
|
||||
if ( $duration ) {
|
||||
$this->newline( '<itunes:duration>' . $duration . '</itunes:duration>', 2 );
|
||||
}
|
||||
|
||||
if ( $author ) {
|
||||
$this->newline( '<itunes:author>' . esc_html( $author ) . '</itunes:author>', 2 );
|
||||
}
|
||||
|
||||
if ( $season_number ) {
|
||||
$this->newline( '<itunes:season>' . esc_html( $season_number ) . '</itunes:season>', 2 );
|
||||
}
|
||||
|
||||
if ( $episode_number ) {
|
||||
$this->newline( '<itunes:episode>' . esc_html( $episode_number ) . '</itunes:episode>', 2 );
|
||||
}
|
||||
|
||||
$this->newline( '<itunes:explicit>' . $is_explicit . '</itunes:explicit>', 2 );
|
||||
|
||||
$tracking_prefix = Helper::get_settings( 'general.podcast_tracking_prefix' );
|
||||
$this->newline( '<enclosure url="' . esc_attr( $tracking_prefix ) . esc_url( $audio_file ) . '" length="' . $duration . '" type="audio/mpeg" />', 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a newline with indent count.
|
||||
*
|
||||
* @param string $content Content to write.
|
||||
* @param integer $indent Count of indent.
|
||||
*/
|
||||
private function newline( $content, $indent = 0 ) {
|
||||
echo str_repeat( "\t", $indent ) . $content . "\n";
|
||||
}
|
||||
}
|
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
/**
|
||||
* The Podcast Schema.
|
||||
*
|
||||
* @since 3.0.17
|
||||
* @package RankMath
|
||||
* @subpackage RankMathPro\Schema
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
namespace RankMathPro\Podcast;
|
||||
|
||||
use RankMath\KB;
|
||||
use RankMath\Helper;
|
||||
use RankMath\Traits\Hooker;
|
||||
use MyThemeShop\Helpers\Arr;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Podcast class.
|
||||
*/
|
||||
class Podcast {
|
||||
|
||||
use Hooker;
|
||||
|
||||
/**
|
||||
* The Constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->filter( 'rank_math/settings/general', 'add_settings' );
|
||||
$this->action( 'init', 'init' );
|
||||
$this->action( 'rank_math/vars/register_extra_replacements', 'register_replacements' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Intialize.
|
||||
*/
|
||||
public function init() {
|
||||
add_feed( 'podcast', [ $this, 'podcast_feed' ] );
|
||||
new Podcast_RSS();
|
||||
new Publish_Podcast();
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers variable replacements for Rank Math Pro.
|
||||
*/
|
||||
public function register_replacements() {
|
||||
rank_math_register_var_replacement(
|
||||
'podcast_image',
|
||||
[
|
||||
'name' => esc_html__( 'Podcast Image', 'rank-math-pro' ),
|
||||
'description' => esc_html__( 'Podcast channel image configured in the Rank Math Settings.', 'rank-math-pro' ),
|
||||
'variable' => 'podcast_image',
|
||||
'example' => '',
|
||||
],
|
||||
[ $this, 'get_podcast_image' ]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Podcast image from the Settings.
|
||||
*
|
||||
* @return string Podcast image.
|
||||
*/
|
||||
public function get_podcast_image() {
|
||||
return Helper::get_settings( 'general.podcast_image' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add module settings in the General Settings panel.
|
||||
*
|
||||
* @param array $tabs Array of option panel tabs.
|
||||
* @return array
|
||||
*/
|
||||
public function add_settings( $tabs ) {
|
||||
Arr::insert(
|
||||
$tabs,
|
||||
[
|
||||
'podcast' => [
|
||||
'icon' => 'rm-icon rm-icon-podcast',
|
||||
'title' => esc_html__( 'Podcast', 'rank-math-pro' ),
|
||||
/* translators: Link to kb article */
|
||||
'desc' => sprintf( esc_html__( 'Make your podcasts discoverable via Google Podcasts, Apple Podcasts, and similar services. %s.', 'rank-math' ), '<a href="' . KB::get( 'podcast-settings', 'Options Panel Podcast Tab' ) . '" target="_blank">' . esc_html__( 'Learn more', 'rank-math-pro' ) . '</a>' ),
|
||||
'file' => dirname( __FILE__ ) . '/views/options.php',
|
||||
/* translators: Link to Podcast RSS feed */
|
||||
'after_row' => '<div class="notice notice-alt notice-info info inline rank-math-notice"><p>' . sprintf( esc_html__( 'Your Podcast RSS feed can be found here: %s', 'rank-math-pro' ), '<a href="' . Helper::get_home_url( 'feed/podcast' ) . '" target="_blank">' . Helper::get_home_url( 'feed/podcast' ) . '</a>' ) . '</p></div>',
|
||||
],
|
||||
],
|
||||
12
|
||||
);
|
||||
|
||||
return $tabs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add all podcasts feed to /feed/podcast.
|
||||
*/
|
||||
public function podcast_feed() {
|
||||
require dirname( __FILE__ ) . '/views/feed-rss2.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get podcasts
|
||||
*/
|
||||
public function get_podcasts() {
|
||||
$post_types = array_filter(
|
||||
Helper::get_accessible_post_types(),
|
||||
function( $post_type ) {
|
||||
return 'attachment' !== $post_type;
|
||||
}
|
||||
);
|
||||
|
||||
$args = $this->do_filter(
|
||||
'podcast_args',
|
||||
[
|
||||
'post_type' => array_keys( $post_types ),
|
||||
'posts_per_page' => get_option( 'posts_per_rss' ),
|
||||
'meta_query' => [
|
||||
[
|
||||
'key' => 'rank_math_schema_PodcastEpisode',
|
||||
'compare' => 'EXISTS',
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
return new \WP_Query( $args );
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
/**
|
||||
* Add Podcasts RSS feed.
|
||||
*
|
||||
* @since 3.0.17
|
||||
* @package RankMath
|
||||
* @subpackage RankMathPro\Schema
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
namespace RankMathPro\Podcast;
|
||||
|
||||
use RankMath\Helper;
|
||||
use RankMath\Traits\Hooker;
|
||||
use RankMath\Schema\DB;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Publish_Podcast class.
|
||||
*/
|
||||
class Publish_Podcast {
|
||||
|
||||
use Hooker;
|
||||
|
||||
/**
|
||||
* Has Podcast schema.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $has_podcast_schema = false;
|
||||
|
||||
/**
|
||||
* The Constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->action( 'rank_math/schema/update', 'publish_podcast' );
|
||||
$this->action( 'rank_math/pre_update_schema', 'has_podcast_schema' );
|
||||
|
||||
$this->action( 'rss2_podcast_head', 'add_hub_urls' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if current post already have a Podcast schema.
|
||||
*
|
||||
* @param int $post_id Current Post ID.
|
||||
*/
|
||||
public function has_podcast_schema( $post_id ) {
|
||||
$schema_types = DB::get_schema_types( $post_id );
|
||||
$this->has_podcast_schema = ! empty( $schema_types ) && in_array( 'PodcastEpisode', explode( ', ', $schema_types ), true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish podcast when a new post is published.
|
||||
*
|
||||
* @param int $post_id Current Post ID.
|
||||
*/
|
||||
public function publish_podcast( $post_id ) {
|
||||
if ( $this->has_podcast_schema ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$podcast = get_post_meta( $post_id, 'rank_math_schema_PodcastEpisode', true );
|
||||
if ( empty( $podcast ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$hub_urls = $this->get_hub_urls();
|
||||
if ( empty( $hub_urls ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$user_agent = $this->do_filter( 'podcast/useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ) );
|
||||
$podcast_feed = esc_url( home_url( 'feed/podcast' ) );
|
||||
$args = [
|
||||
'timeout' => 100,
|
||||
'user-agent' => "$user_agent; PubSubHubbub/WebSub",
|
||||
'body' => "hub.mode=publish&hub.url={$podcast_feed}",
|
||||
];
|
||||
|
||||
foreach ( $hub_urls as $hub_url ) {
|
||||
wp_remote_post( $hub_url, $args );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Hub urls to podcast feed.
|
||||
*/
|
||||
public function add_hub_urls() {
|
||||
$hub_urls = $this->get_hub_urls();
|
||||
if ( empty( $hub_urls ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ( $hub_urls as $hub_url ) {
|
||||
echo '<atom:link rel="hub" href="' . esc_url( $hub_url ) . '" />';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get podcast Hub URLs.
|
||||
*/
|
||||
private function get_hub_urls() {
|
||||
return $this->do_filter(
|
||||
'podcast/hub_urls',
|
||||
[
|
||||
'https://pubsubhubbub.appspot.com',
|
||||
'https://pubsubhubbub.superfeedr.com',
|
||||
'https://websubhub.com/hub',
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
/**
|
||||
* RSS2 Feed Template for displaying RSS2 Posts feed.
|
||||
* Forked from WordPress Core - feed-rss2.php.
|
||||
*
|
||||
* @package WordPress
|
||||
*/
|
||||
|
||||
header( 'Content-Type: ' . feed_content_type( 'rss2' ) . '; charset=' . get_option( 'blog_charset' ), true );
|
||||
$more = 1;
|
||||
|
||||
echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?' . '>';
|
||||
|
||||
/**
|
||||
* Filter to remove Podcast feed credit.
|
||||
*
|
||||
* @param boolean Defaults to false.
|
||||
*/
|
||||
if ( ! apply_filters( 'rank_math/podcast/remove_credit', false ) ) {
|
||||
echo "\n<!-- This Podcast feed is generated by Rank Math PRO SEO plugin - rankmath.com -->\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires between the xml and rss tags in a feed.
|
||||
*
|
||||
* @param string $context Type of feed. Possible values include 'rss2', 'rss2-comments',
|
||||
* 'rdf', 'atom', and 'atom-comments'.
|
||||
*/
|
||||
do_action( 'rss_tag_pre', 'rss2' );
|
||||
?>
|
||||
<rss version="2.0"
|
||||
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
||||
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:atom="http://www.w3.org/2005/Atom"
|
||||
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
|
||||
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
|
||||
<?php
|
||||
/**
|
||||
* Fires at the end of the RSS root to add namespaces.
|
||||
*/
|
||||
do_action( 'rss2_ns' );
|
||||
do_action( 'rss2_podcast_ns' );
|
||||
?>
|
||||
>
|
||||
<channel>
|
||||
<title><?php wp_title_rss(); ?></title>
|
||||
<atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
|
||||
<link><?php bloginfo_rss( 'url' ); ?></link>
|
||||
<description><?php bloginfo_rss( 'description' ); ?></description>
|
||||
<lastBuildDate><?php echo get_feed_build_date( 'r' ); ?></lastBuildDate>
|
||||
<language><?php bloginfo_rss( 'language' ); ?></language>
|
||||
<sy:updatePeriod>
|
||||
<?php
|
||||
$duration = 'hourly';
|
||||
|
||||
/**
|
||||
* Filters how often to update the RSS feed.
|
||||
*
|
||||
* @param string $duration The update period. Accepts 'hourly', 'daily', 'weekly', 'monthly',
|
||||
* 'yearly'. Default 'hourly'.
|
||||
*/
|
||||
echo apply_filters( 'rss_update_period', $duration );
|
||||
?>
|
||||
</sy:updatePeriod>
|
||||
<sy:updateFrequency>
|
||||
<?php
|
||||
$frequency = '1';
|
||||
|
||||
/**
|
||||
* Filters the RSS update frequency.
|
||||
*
|
||||
* @param string $frequency An integer passed as a string representing the frequency
|
||||
* of RSS updates within the update period. Default '1'.
|
||||
*/
|
||||
echo apply_filters( 'rss_update_frequency', $frequency );
|
||||
?>
|
||||
</sy:updateFrequency>
|
||||
<?php
|
||||
/**
|
||||
* Fires at the end of the RSS2 Feed Header.
|
||||
*/
|
||||
do_action( 'rss2_head' );
|
||||
do_action( 'rss2_podcast_head' );
|
||||
|
||||
$podcast_query = $this->get_podcasts();
|
||||
while ( $podcast_query->have_posts() ) :
|
||||
$podcast_query->the_post();
|
||||
?>
|
||||
<item>
|
||||
<title><?php the_title_rss(); ?></title>
|
||||
<link><?php the_permalink_rss(); ?></link>
|
||||
<?php if ( get_comments_number() || comments_open() ) : ?>
|
||||
<comments><?php comments_link_feed(); ?></comments>
|
||||
<?php endif; ?>
|
||||
|
||||
<dc:creator><![CDATA[<?php the_author(); ?>]]></dc:creator>
|
||||
<pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate>
|
||||
<?php the_category_rss( 'rss2' ); ?>
|
||||
<guid isPermaLink="false"><?php the_guid(); ?></guid>
|
||||
|
||||
<?php if ( get_option( 'rss_use_excerpt' ) ) : ?>
|
||||
<description><![CDATA[<?php the_excerpt(); ?>]]></description>
|
||||
<?php else : ?>
|
||||
<description><![CDATA[<?php the_excerpt(); ?>]]></description>
|
||||
<?php
|
||||
$content = apply_filters( 'the_content', get_the_content() );
|
||||
$content = str_replace( ']]>', ']]>', $content );
|
||||
?>
|
||||
<?php if ( strlen( $content ) > 0 ) : ?>
|
||||
<content:encoded><![CDATA[<?php echo $content; ?>]]></content:encoded>
|
||||
<?php else : ?>
|
||||
<content:encoded><![CDATA[<?php the_excerpt(); ?>]]></content:encoded>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( get_comments_number() || comments_open() ) : ?>
|
||||
<wfw:commentRss><?php echo esc_url( get_post_comments_feed_link( null, 'rss2' ) ); ?></wfw:commentRss>
|
||||
<slash:comments><?php echo get_comments_number(); ?></slash:comments>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php rss_enclosure(); ?>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Fires at the end of each RSS2 feed item.
|
||||
*/
|
||||
do_action( 'rss2_item' );
|
||||
do_action( 'rss2_podcast_item' );
|
||||
?>
|
||||
</item>
|
||||
<?php endwhile; ?>
|
||||
</channel>
|
||||
</rss>
|
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
/**
|
||||
* Podcast general settings.
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMathPro\Schema
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'podcast_title',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'Podcast Name', 'rank-math-pro' ),
|
||||
'desc' => esc_html__( 'Name of the podcast.', 'rank-math-pro' ),
|
||||
'classes' => 'rank-math-supports-variables',
|
||||
'default' => '%sitename%',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'podcast_description',
|
||||
'type' => 'textarea_small',
|
||||
'name' => esc_html__( 'Podcast Description', 'rank-math-pro' ),
|
||||
'desc' => esc_html__( 'A plaintext description of the podcast.', 'rank-math-pro' ),
|
||||
'classes' => 'rank-math-supports-variables',
|
||||
'default' => '%sitedesc%',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'podcast_owner',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'Owner Name', 'rank-math-pro' ),
|
||||
'desc' => esc_html__( 'The podcast owner contact name.', 'rank-math-pro' ),
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'podcast_owner_email',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'Owner Email ', 'rank-math-pro' ),
|
||||
'desc' => esc_html__( 'The email address of the podcast owner. Please make sure the email address is active and monitored.', 'rank-math-pro' ),
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'podcast_category',
|
||||
'type' => 'select',
|
||||
'name' => esc_html__( 'Podcast Category', 'rank-math-pro' ),
|
||||
'options' => [
|
||||
'' => esc_html__( 'None', 'rank-math-pro' ),
|
||||
'Arts' => esc_html__( 'Arts', 'rank-math-pro' ),
|
||||
'Business' => esc_html__( 'Business', 'rank-math-pro' ),
|
||||
'Comedy' => esc_html__( 'Comedy', 'rank-math-pro' ),
|
||||
'Education' => esc_html__( 'Education', 'rank-math-pro' ),
|
||||
'Games & Hobbies' => esc_html__( 'Games & Hobbies', 'rank-math-pro' ),
|
||||
'Government & Organizations' => esc_html__( 'Government & Organizations', 'rank-math-pro' ),
|
||||
'Health' => esc_html__( 'Health', 'rank-math-pro' ),
|
||||
'Kids & Family' => esc_html__( 'Kids & Family', 'rank-math-pro' ),
|
||||
'Music' => esc_html__( 'Music', 'rank-math-pro' ),
|
||||
'News & Politics' => esc_html__( 'News & Politics', 'rank-math-pro' ),
|
||||
'Religion & Spirituality' => esc_html__( 'Religion & Spirituality', 'rank-math-pro' ),
|
||||
'Science & Medicine' => esc_html__( 'Science & Medicine', 'rank-math-pro' ),
|
||||
'Society & Culture' => esc_html__( 'Society & Culture', 'rank-math-pro' ),
|
||||
'Sports & Recreation' => esc_html__( 'Sports & Recreation', 'rank-math-pro' ),
|
||||
'TV & Film' => esc_html__( 'TV & Film', 'rank-math-pro' ),
|
||||
'Technology' => esc_html__( 'Technology', 'rank-math-pro' ),
|
||||
],
|
||||
'default' => '',
|
||||
'desc' => esc_html__( 'Select the category that best reflects the content of your show.', 'rank-math-pro' ),
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'podcast_image',
|
||||
'type' => 'file',
|
||||
'name' => esc_html__( 'Podcast Image', 'rank-math-pro' ),
|
||||
'desc' => __( '<strong>Min Size: 1400x1400px, Max Size: 3000x3000px</strong>.<br /> The filesize should not exceed 0.5MB.', 'rank-math-pro' ),
|
||||
'options' => [ 'url' => false ],
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'podcast_tracking_prefix',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'Tracking Prefix', 'rank-math-pro' ),
|
||||
'desc' => esc_html__( 'Add the tracking prefix provided by your tracking service like Chartable, Podsights, Podtrac, etc.', 'rank-math-pro' ),
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'podcast_explicit',
|
||||
'type' => 'toggle',
|
||||
'name' => esc_html__( 'Is Explicit', 'rank-math-pro' ),
|
||||
'desc' => esc_html__( 'Indicates whether the podcast is explicit language or adult content.', 'rank-math-pro' ),
|
||||
'default' => 'off',
|
||||
]
|
||||
);
|
||||
|
||||
$cmb->add_field(
|
||||
[
|
||||
'id' => 'podcast_copyright_text',
|
||||
'type' => 'text',
|
||||
'name' => esc_html__( 'Copyright Text', 'rank-math-pro' ),
|
||||
'desc' => esc_html__( 'Add copyright details if your show is copyrighted.', 'rank-math-pro' ),
|
||||
]
|
||||
);
|
Reference in New Issue
Block a user