本文整理汇总了PHP中get_the_content_feed函数的典型用法代码示例。如果您正苦于以下问题:PHP get_the_content_feed函数的具体用法?PHP get_the_content_feed怎么用?PHP get_the_content_feed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_the_content_feed函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: the_excerpt_rss
?>
<description><![CDATA[<?php
the_excerpt_rss();
?>
]]></description>
<?php
} else {
?>
<description><![CDATA[<?php
the_excerpt_rss();
?>
]]></description>
<?php
$content = get_the_content_feed('rss2');
?>
<?php
if (strlen($content) > 0) {
?>
<content:encoded><![CDATA[<?php
echo $content;
?>
]]></content:encoded>
<?php
} else {
?>
<content:encoded><![CDATA[<?php
开发者ID:grff-alpha,项目名称:grff-alpha-web,代码行数:31,代码来源:feed-rss2.php
示例2: podPress_rss2_item
function podPress_rss2_item()
{
global $podPress, $post, $post_meta_cache, $blog_id, $wp_version;
$enclosureTag = podPress_getEnclosureTags();
if ($enclosureTag != '') {
// if no enclosure tag, no need for iTunes tags
$is_password_protected = podpress_post_is_password_protected();
if (FALSE === $is_password_protected) {
echo $enclosureTag;
}
if ($post->podPressPostSpecific['itunes:subtitle'] == '##PostExcerpt##') {
if (TRUE === $is_password_protected) {
$post->podPressPostSpecific['itunes:subtitle'] = __('This post is password protected.', 'podPress');
} else {
$post->podPressPostSpecific['itunes:subtitle'] = trim(podpress_get_excerpt_rss());
}
}
if (TRUE == empty($post->podPressPostSpecific['itunes:subtitle'])) {
$post->podPressPostSpecific['itunes:subtitle'] = get_the_title_rss();
}
echo ' <itunes:subtitle>' . podPress_strlimiter_end(podPress_feedSafeContent(stripslashes($post->podPressPostSpecific['itunes:subtitle']), FALSE, TRUE), 254, '[...]', TRUE) . '</itunes:subtitle>' . "\n";
if (FALSE == isset($post->podPressPostSpecific['itunes:summary'])) {
$post->podPressPostSpecific['itunes:summary'] = '##PostContentShortened##';
}
switch ($post->podPressPostSpecific['itunes:summary']) {
case '##Global##':
$post->podPressPostSpecific['itunes:summary'] = $podPress->settings['iTunes']['summary'];
break;
case '##PostExcerpt##':
if (TRUE === $is_password_protected) {
$post->podPressPostSpecific['itunes:summary'] = __('This post is password protected.', 'podPress');
} else {
$post->podPressPostSpecific['itunes:summary'] = trim(podpress_get_excerpt_rss());
}
break;
case '##PostContentShortened##':
if (post_password_required($post)) {
$post->podPressPostSpecific['itunes:summary'] = __('This post is password protected.', 'podPress');
} else {
if (TRUE == version_compare($wp_version, '2.9', '>=')) {
$post->podPressPostSpecific['itunes:summary'] = get_the_content_feed();
} else {
$post->podPressPostSpecific['itunes:summary'] = trim(podpress_get_content_rss());
}
}
break;
}
if (FALSE == empty($post->podPressPostSpecific['itunes:summary'])) {
echo ' <itunes:summary>' . podPress_strlimiter_end(podPress_feedSafeContent(stripslashes($post->podPressPostSpecific['itunes:summary']), FALSE, TRUE), 4000, '[...]', TRUE) . '</itunes:summary>' . "\n";
}
switch ($post->podPressPostSpecific['itunes:keywords']) {
default:
case '##WordPressCats##':
$categories = get_the_category();
$post->podPressPostSpecific['itunes:keywords'] = '';
if (TRUE == is_array($categories) and FALSE == empty($categories)) {
$category_names = array();
$b = '';
foreach ($categories as $category) {
$result = preg_match('/\\S+\\s+\\S+/', $category->cat_name, $b);
// take the category name only if it does not contain inner white spaces (if it does not consist of more than one word)
if (TRUE == empty($b)) {
$category_names[] = $category->cat_name;
}
}
if (TRUE == is_array($category_names) and FALSE == empty($category_names)) {
$nr_category_names = count($category_names);
if ($nr_category_names > 1) {
for ($i = 0; $i < min($nr_category_names, 12); $i++) {
// max. 12 keywords are allowed
if (0 == $i) {
$post->podPressPostSpecific['itunes:keywords'] = $category_names[$i];
} else {
$post->podPressPostSpecific['itunes:keywords'] .= ', ' . $category_names[$i];
}
}
} elseif ($nr_category_names === 1) {
$post->podPressPostSpecific['itunes:keywords'] = $category_names[0];
}
}
}
break;
case '##post_tags##':
$posttags = get_the_tags();
$post->podPressPostSpecific['itunes:keywords'] = '';
if (is_array($posttags) and FALSE == empty($posttags)) {
$posttags_nr = count($posttags);
$i = 0;
foreach ($posttags as $tag) {
if ($i == $posttags_nr - 1) {
$post->podPressPostSpecific['itunes:keywords'] .= $tag->name;
} else {
$post->podPressPostSpecific['itunes:keywords'] .= $tag->name . ', ';
}
$i++;
}
}
break;
case '##Global##':
$post->podPressPostSpecific['itunes:keywords'] = $podPress->settings['iTunes']['keywords'];
//.........这里部分代码省略.........
开发者ID:niko-lgdcom,项目名称:archives,代码行数:101,代码来源:podpress_feed_functions.php
示例3: the_content_feed
/**
* Display the post content for feeds.
*
* @since 2.9.0
*
* @param string $feed_type The type of feed. rss2 | atom | rss | rdf
*/
function the_content_feed($feed_type = null)
{
echo get_the_content_feed($feed_type);
}
开发者ID:RA2WP,项目名称:RA2WP,代码行数:11,代码来源:feed.php
示例4: testLessonFeedContentPermissions
/**
* Make sure no content is returned for lessons in the feeds.
*/
public function testLessonFeedContentPermissions()
{
global $post;
$post = get_post($this->lessons[1]);
setup_postdata($post);
// Check rss2 feed.
$the_content = get_the_content_feed('rss2');
$this->assertEquals('', $the_content);
// Check atom feed.
$the_content = get_the_content_feed('atom');
$this->assertEquals('', $the_content);
// Check rss feed.
$the_content = get_the_content_feed('rss');
$this->assertEquals('', $the_content);
// Check rdf feed.
$the_content = get_the_content_feed('rdf');
$this->assertEquals('', $the_content);
wp_reset_postdata();
}
开发者ID:rcnascimento,项目名称:ibeducator,代码行数:22,代码来源:test-lessons-permissions.php
示例5: while
}
?>
<?php
while (have_posts()) {
the_post();
?>
<?php
$post_id = get_the_ID();
$episode_number = get_post_meta($post_id, 'episode_number', true);
$episode_subtitle = get_post_meta($post_id, 'episode_subtitle', true);
// Get Episode Media Source
$episode_attachment_id = get_post_meta($post_id, 'episode_file', true);
$episode_external_file = get_post_meta($post_id, 'external_episode_file', true);
$episode_cleaned_content = strip_tags(get_the_content_feed());
$episode_cleaned_subtitle = strip_tags($episode_subtitle);
if (!empty($episode_attachment_id)) {
$player_src = wp_get_attachment_url($episode_attachment_id);
} elseif (!empty($episode_external_file)) {
$player_src = $episode_external_file;
}
$media_info = wp_get_attachment_metadata($episode_attachment_id);
$episode_artwork_src = $podcast_artwork_src;
$episode_artwork_id = get_post_thumbnail_id($post_id);
if (!empty($episode_artwork_id)) {
$episode_artwork = wp_get_attachment_image_src($episode_artwork_id, 'cap-podcast-thumbnail');
$episode_artwork_src = $episode_artwork[0];
}
?>
开发者ID:amprog,项目名称:cap-podcaster,代码行数:30,代码来源:rss-feed.php
示例6: override_feed_entry
function override_feed_entry($hook, $podcast, $feed, $format)
{
add_action($hook, function () use($podcast, $feed, $format) {
global $post;
$cache = \Podlove\Cache\TemplateCache::get_instance();
echo $cache->cache_for('feed_item_' . $feed->slug . '_' . $post->ID, function () use($podcast, $feed, $format, $post) {
$xml = "";
$episode = Model\Episode::find_one_by_post_id($post->ID);
$asset = $feed->episode_asset();
$file = Model\MediaFile::find_by_episode_id_and_episode_asset_id($episode->id, $asset->id);
$asset_assignment = Model\AssetAssignment::get_instance();
if (!$file) {
return;
}
$enclosure_file_size = $file->size;
$cover_art_url = "";
if ($cover_art = $episode->cover_art()) {
$cover_art_url = $cover_art->url();
}
if (isset($_REQUEST['tracking']) && $_REQUEST['tracking'] == 'no') {
$enclosure_url = $episode->enclosure_url($feed->episode_asset(), null, null);
} else {
$enclosure_url = $episode->enclosure_url($feed->episode_asset(), "feed", $feed->slug);
}
$deep_link = Model\Feed::get_link_tag(array('prefix' => 'atom', 'rel' => 'http://podlove.org/deep-link', 'type' => '', 'title' => '', 'href' => get_permalink() . "#"));
$xml .= apply_filters('podlove_deep_link', $deep_link, $feed);
$xml .= apply_filters('podlove_feed_enclosure', '', $enclosure_url, $enclosure_file_size, $format->mime_type, $file);
$duration = sprintf('<itunes:duration>%s</itunes:duration>', $episode->get_duration('HH:MM:SS'));
$xml .= apply_filters('podlove_feed_itunes_duration', $duration);
$author = apply_filters('podlove_feed_content', $podcast->author_name);
$author = sprintf('<itunes:author>%s</itunes:author>', $author);
$xml .= apply_filters('podlove_feed_itunes_author', $author);
$subtitle = apply_filters('podlove_feed_content', \Podlove\PHP\escape_shortcodes(strip_tags($episode->subtitle)));
$subtitle = sprintf('<itunes:subtitle>%s</itunes:subtitle>', $subtitle);
$xml .= apply_filters('podlove_feed_itunes_subtitle', $subtitle);
$summary = apply_filters('podlove_feed_content', \Podlove\PHP\escape_shortcodes(strip_tags($episode->summary)));
$summary = sprintf('<itunes:summary>%s</itunes:summary>', $summary);
$xml .= apply_filters('podlove_feed_itunes_summary', $summary);
if (\Podlove\get_setting('metadata', 'enable_episode_explicit')) {
$itunes_explicit = apply_filters('podlove_feed_content', $episode->explicit_text());
$itunes_explicit = sprintf('<itunes:explicit>%s</itunes:explicit>', $itunes_explicit);
$xml .= apply_filters('podlove_feed_itunes_explicit', $itunes_explicit);
}
if ($cover_art_url) {
$cover_art = sprintf('<itunes:image href="%s" />', $cover_art_url);
} else {
$cover_art = '';
}
$xml .= apply_filters('podlove_feed_itunes_image', $cover_art);
if ($feed->embed_content_encoded) {
add_filter('the_content_feed', function ($content, $feed_type) {
return preg_replace('#<style(.*?)>(.*?)</style>#is', '', $content);
}, 10, 2);
$content_encoded = '<content:encoded><![CDATA[' . get_the_content_feed('rss2') . ']]></content:encoded>';
$xml .= apply_filters('podlove_feed_content_encoded', $content_encoded);
}
ob_start();
do_action('podlove_append_to_feed_entry', $podcast, $episode, $feed, $format);
$xml .= ob_get_contents();
ob_end_clean();
return $xml;
}, 15 * MINUTE_IN_SECONDS);
}, 11);
}
开发者ID:johannes-mueller,项目名称:podlove-publisher,代码行数:64,代码来源:base.php
注:本文中的get_the_content_feed函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论