我在iTunes上的播客说明中出现了一些HTML ascii代码的问题。不幸的是,我对PHP不太满意,但无论如何我都在尝试!我找到了一个我认为可以替换或剥离代码的部分....
// iTunes summary does not allow any HTML and must be shorter than 4000 characters
$itunes_summary = strip_tags( get_the_content() );
$itunes_summary = str_replace( array( '&', '>', '<', '\'', '"', '`' ), array( __( 'and', 'seriously-simple-podcasting' ), '', '', '', '', '' ), $itunes_summary );
$itunes_summary = mb_substr( $itunes_summary, 0, 3949 );
// iTunes short description does not allow any HTML and must be shorter than 4000 characters
$itunes_excerpt = strip_tags( strip_shortcodes( get_the_excerpt() ) );
$itunes_excerpt = str_replace( array( '&', '>', '<', '\'', '"', '`', '[andhellip;]', '[…]' ), array( 'and', '', '', '', '', '', '', '' ), $itunes_excerpt );
$itunes_excerpt = mb_substr( $itunes_excerpt, 0, 224 );
但它似乎没有效果,因为输出看起来像这样......
<description>
<![CDATA[
Post Father’s Day tea time on the DahlCast – What’s your fav? Lipton, Snapple or handle bar mustaches? Pet peeves raid today’s show as the guys talk flip flops, situational unawareness and open table plus the internet’s latest craze the Cheerio Challenge.
]]>
</description>
<itunes:subtitle>
<![CDATA[
Post Fatherand#8217;s Day tea time on the DahlCast and#8211; Whatand#8217;s your fav? Lipton, Snapple or handle bar mustaches? Pet peeves raid todayand#8217;s show as the guys talk flip flops, situational unawareness and open table plus the internetand#8
]]>
</itunes:subtitle>
<content:encoded>
<![CDATA[
<p>Post Father’s Day tea time on the DahlCast – What’s your fav? Lipton, Snapple or handle bar mustaches? Pet peeves raid today’s show as the guys talk flip flops, situational unawareness and open table plus the internet’s latest craze the Cheerio Challenge.</p>
]]>
</content:encoded>
<itunes:summary>
<![CDATA[
Post Father's Day tea time on the DahlCast – What's your fav? Lipton, Snapple or handle bar mustaches? Pet peeves raid today's show as the guys talk flip flops, situational unawareness and open table plus the internet's latest craze the Cheerio Challenge.
]]>
</itunes:summary>
正如你所看到的......有时候撇号会起作用......其他时候它并不适用。奇怪...
如果它有用,可以在这里构建项目...
<item>
<title><?php esc_html( the_title_rss() ); ?></title>
<link><?php esc_url( the_permalink_rss() ); ?></link>
<pubDate><?php echo esc_html( mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ) ); ?></pubDate>
<dc:creator><?php echo $author; ?></dc:creator>
<guid isPermaLink="false"><?php esc_html( the_guid() ); ?></guid>
<description><![CDATA[<?php the_excerpt_rss(); ?>]]></description>
<itunes:subtitle><?php echo $itunes_excerpt; ?></itunes:subtitle>
<content:encoded><![CDATA[<?php echo $content; ?>]]></content:encoded>
<itunes:summary><?php echo $itunes_summary; ?></itunes:summary><?php if ( $episode_image ) { ?>
<itunes:image href="<?php echo esc_url( $episode_image ); ?>"></itunes:image><?php } ?>
<enclosure url="<?php echo esc_url( $enclosure ); ?>" length="<?php echo esc_attr( $size ); ?>" type="<?php echo esc_attr( $mime_type ); ?>"></enclosure>
<itunes:explicit><?php echo esc_html( $explicit_flag ); ?></itunes:explicit>
<itunes:block><?php echo esc_html( $block_flag ); ?></itunes:block>
<itunes:duration><?php echo esc_html( $duration ); ?></itunes:duration>
<itunes:author><?php echo $author; ?></itunes:author>
</item>
非常感谢你的时间和考虑!