本文整理汇总了PHP中get_feed_link函数的典型用法代码示例。如果您正苦于以下问题:PHP get_feed_link函数的具体用法?PHP get_feed_link怎么用?PHP get_feed_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_feed_link函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_pre_posts_per_page
/**
* @ticket 25380
*/
function test_pre_posts_per_page()
{
self::factory()->post->create_many(10);
add_action('pre_get_posts', array($this, 'filter_posts_per_page'));
$this->go_to(get_feed_link());
$this->assertEquals(30, get_query_var('posts_per_page'));
}
示例2: cap_podcast_change_archive_title
function cap_podcast_change_archive_title($title)
{
if (is_post_type_archive('cap_podcast')) {
$title = $title . '<div class="rss-feed"><a href="' . get_feed_link() . '?post_type=cap_podcast"><span class="dashicons dashicons-rss"></span> Subscribe to Podcast</a></div>';
}
return $title;
}
示例3: add_feed_links
public static function add_feed_links()
{
global $wpz_default_feed;
$wpz_default_feed = get_feed_link();
add_theme_support('automatic-feed-links');
add_filter('feed_link', array(__CLASS__, 'custom_feed_links'), 1);
}
示例4: ar2_theme_options_default_fields
/**
* Retrieves default setting fields for theme options.
* @since 1.6
*/
function ar2_theme_options_default_fields()
{
global $ar2_image_sizes, $ar2_styles;
$_defaults = array('theme_version' => array('type' => 'static', 'title' => __('Version', 'ar2'), 'section' => 'ar2_general_site_info', 'content' => '<strong>' . wp_get_theme()->get('Version') . '</strong>', 'description' => __('If you have recently upgraded Project AR2 to a new release, it is <span style="color: red">highly recommended</span> that you reset your theme options, clear your browser cache and restart your browser before proceeding.', 'ar2')), 'site_rss_feed' => array('type' => 'static', 'title' => __('RSS Feed', 'ar2'), 'section' => 'ar2_general_social', 'content' => '<code>' . get_feed_link('rss2') . '</code>', 'description' => __('Custom feed URLs are no longer allowed due to support for automatic feed links.', 'ar2')), 'social_twitter' => array('type' => 'input', 'title' => __('Twitter Username', 'ar2'), 'section' => 'ar2_general_social'), 'social_facebook' => array('type' => 'input', 'title' => __('Facebook Username', 'ar2'), 'section' => 'ar2_general_social'), 'social_flickr' => array('type' => 'input', 'title' => __('Flickr ID', 'ar2'), 'section' => 'ar2_general_social'), 'social_gplus' => array('type' => 'input', 'title' => __('Google+ ID', 'ar2'), 'section' => 'ar2_general_social'), 'social_youtube' => array('type' => 'input', 'title' => __('YouTube Channel ID', 'ar2'), 'section' => 'ar2_general_social'), 'footer_message' => array('type' => 'textarea_html', 'title' => __('Footer Message', 'ar2'), 'section' => 'ar2_general_footer', 'description' => __("Usually your website's copyright information would go here.<br /> It would be great if you could include a link to WordPress or the theme website. :)", 'ar2'), 'extras' => 'class="code"'), 'nodebased_show_excerpts' => array('type' => 'switch', 'title' => __('Show Excerpts', 'ar2'), 'section' => 'ar2_layout_excerpts'), 'excerpt_limit' => array('type' => 'input', 'title' => __('Excerpt Limit', 'ar2'), 'section' => 'ar2_layout_excerpts', 'extras' => 'style="width: 50px" maxlength="2"', 'description' => __('Excerpts will only be trimmed to the limit if no excerpt is specified for the respective post.', 'ar2')), 'archive_display' => array('type' => 'dropdown', 'title' => __('Display Type', 'ar2'), 'section' => 'ar2_layout_archive', 'options' => ar2_get_archive_display_types()), 'single_posts_display' => array('type' => 'custom', 'title' => __('Display in Single Posts', 'ar2'), 'section' => 'ar2_layout_single', 'callback' => 'ar2_render_single_form_field', 'setting' => 'ar2_theme_options[post_display]'), 'relative_dates' => array('type' => 'checkbox', 'title' => __('Display Relative Post Dates', 'ar2'), 'section' => 'ar2_layout_single', 'description' => __('Check this to display post dates relative to current time (eg. 2 days ago ).', 'ar2')), 'auto_thumbs' => array('type' => 'checkbox', 'title' => __('Auto Thumbnails', 'ar2'), 'section' => 'ar2_thumbnails_options', 'description' => __('Check this to allow the theme to automatically retrieve the first attached image from the post as featured image when no image is specified.', 'ar2')), 'layout' => array('type' => 'dropdown', 'title' => __('No of Columns', 'ar2'), 'section' => 'ar2_design_overall', 'options' => $ar2_styles->get_layouts()), 'import_theme_options' => array('type' => 'textarea', 'title' => __('Import Theme Options', 'ar2'), 'section' => 'ar2_tools_port', 'description' => __('Import your theme settings by pasting the exported code in the textbox above.', 'ar2'), 'extras' => 'class="code"'), 'export_theme_options' => array('type' => 'textarea', 'title' => __('Export Theme Options', 'ar2'), 'section' => 'ar2_tools_port', 'description' => __('You can save the code above into a text file and use it when you need to import them into another installation. Note that not all options (custom background, child theme settings, etc.) will be exported.', 'ar2'), 'extras' => 'class="code"', 'value' => json_encode(ar2_flush_theme_options())));
foreach ($ar2_image_sizes as $id => $args) {
$_defaults[$id] = array('type' => 'thumbnail-size', 'title' => $args['name'], 'setting' => 'ar2_theme_options[thumbnails][' . $id . ']', 'section' => 'ar2_thumbnails_sizes', 'width' => $args['w'], 'height' => $args['h'], 'd_width' => $args['dw'], 'd_height' => $args['dh']);
}
if (AR2_ALLOW_CUSTOM_STYLES) {
$_defaults['style'] = array('type' => 'dropdown', 'title' => __('Custom Stylesheet', 'ar2'), 'section' => 'ar2_design_overall', 'options' => ar2_get_custom_css_files(), 'description' => sprintf(__('Stylesheets can be placed in %s.', 'ar2'), '<code>wp-content/themes/' . get_stylesheet() . '/css/styles/</code>'));
}
// Allow developers to add more fields
$_defaults = apply_filters('ar2_theme_options_fields', $_defaults);
// Process the fields
$sections = ar2_theme_options_default_sections();
$_default_args = array('title' => '', 'type' => 'static', 'section' => 'ar2_general_site_info', 'page' => 'ar2_general', 'content' => '', 'extras' => '');
foreach ($_defaults as $id => &$args) {
if (!isset($args['setting'])) {
$args['setting'] = 'ar2_theme_options[' . $id . ']';
}
// Parse the ID for array keys (adapted from WP_Customize_Setting class).
$args['_id_data']['keys'] = preg_split('/\\[/', str_replace(']', '', $args['setting']));
$args['_id_data']['base'] = array_shift($args['_id_data']['keys']);
if (isset($sections[$args['section']])) {
$args['page'] = $sections[$args['section']]['page'];
}
$args = wp_parse_args($args, $_default_args);
}
return $_defaults;
}
示例5: loadOptions
public function loadOptions()
{
global $wpdb, $shortname;
$themeOptions = array();
if (!empty($this->options)) {
foreach ($this->options as $option) {
if (isset($option["id"]) && $option["id"] != '' && $option["id"] != $shortname . '_code') {
$themeOptions[$option["id"]] = "";
}
}
$themeKeys = '"';
$themeKeys .= join('","', array_keys($themeOptions));
$themeKeys .= '"';
$optionValues = $wpdb->get_results('SELECT option_name, option_value FROM wp_options WHERE option_name IN (' . $themeKeys . ')');
foreach ($optionValues as $optionValue) {
$themeOptions[$optionValue->option_name] = $optionValue->option_value;
}
wp_reset_query();
$wpdb->flush();
}
$themeOptions['feed'] = get_feed_link();
$themeOptions['site_name'] = get_bloginfo('name');
$themeOptions['site_link'] = esc_url(home_url('/'));
return $themeOptions;
}
示例6: head_cleanup
/**
* Clean up wp_head()
*
* Remove unnecessary <link>'s
* Remove inline CSS and JS from WP emoji support
* Remove inline CSS used by Recent Comments widget
* Remove inline CSS used by posts with galleries
* Remove self-closing tag and change ''s to "'s on rel_canonical()
*
* You can enable/disable this feature in functions.php (or lib/setup.php if you're using Sage):
* add_theme_support('soil-clean-up');
*/
function head_cleanup()
{
// Originally from http://wpengineer.com/1438/wordpress-header/
remove_action('wp_head', 'feed_links_extra', 3);
add_action('wp_head', 'ob_start', 1, 0);
add_action('wp_head', function () {
$pattern = '/.*' . preg_quote(esc_url(get_feed_link('comments_' . get_default_feed())), '/') . '.*[\\r\\n]+/';
echo preg_replace($pattern, '', ob_get_clean());
}, 3, 0);
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('admin_print_scripts', 'print_emoji_detection_script');
remove_action('wp_print_styles', 'print_emoji_styles');
remove_action('admin_print_styles', 'print_emoji_styles');
remove_action('wp_head', 'wp_oembed_add_discovery_links');
remove_action('wp_head', 'wp_oembed_add_host_js');
remove_action('wp_head', 'rest_output_link_wp_head', 10, 0);
remove_filter('the_content_feed', 'wp_staticize_emoji');
remove_filter('comment_text_rss', 'wp_staticize_emoji');
remove_filter('wp_mail', 'wp_staticize_emoji_for_email');
add_filter('use_default_gallery_style', '__return_false');
global $wp_widget_factory;
if (isset($wp_widget_factory->widgets['WP_Widget_Recent_Comments'])) {
remove_action('wp_head', [$wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style']);
}
if (!class_exists('WPSEO_Frontend')) {
remove_action('wp_head', 'rel_canonical');
add_action('wp_head', __NAMESPACE__ . '\\rel_canonical');
}
}
示例7: feed_link_variations
/**
* Feed link variations.
*
* @since 150218 Refactoring cache clear/purge routines.
*
* @param string $type_prefix A feed type prefix; optional.
*
* @return array An array of all feed link variations.
*/
public function feed_link_variations($type_prefix = '')
{
$variations = array();
// Initialize.
foreach ($this->feed_types as $_feed_type) {
$variations[] = get_feed_link((string) $type_prefix . $_feed_type);
}
unset($_feed_type);
// Housekeeping.
return $variations;
}
示例8: ping_feevy
function ping_feevy()
{
$url = "http://localhost:3000/ping/update";
$data = "url=" . urlencode(get_feed_link('rss2'));
$params = array('http' => array('method' => 'POST', 'content' => $data));
$ctx = stream_context_create($params);
$fp = @fopen($url, 'rb', false, $ctx);
if (!$fp) {
throw new Exception("Problem with {$url}, {$php_errormsg}");
}
}
示例9: wpHead
public function wpHead()
{
?>
<link rel="alternate" type="application/atom+xml" title="<?php
echo esc_attr(get_bloginfo('name'));
?>
Feed" href="<?php
echo esc_attr(get_feed_link('atom'));
?>
">
<?php
}
示例10: govsite_core_behaviour_wp_head
function govsite_core_behaviour_wp_head()
{
?>
<link rel="alternate" type="application/atom+xml" title="<?php
echo get_bloginfo('name');
?>
Feed" href="<?php
echo esc_attr(get_feed_link('atom'));
?>
">
<?php
}
示例11: language_attributes
<!doctype html>
<html class="no-js" <?php language_attributes(); ?>>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="alternate" type="application/rss+xml" title="<?php echo get_bloginfo('name'); ?> Feed" href="<?php echo esc_url(get_feed_link()); ?>">
<?php wp_head(); ?>
<!--[if lt IE 9]>
<script type="text/javascript" src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script type="text/javascript" src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!--[if lt IE 9]>
<link rel="stylesheet" href="<?php bloginfo('template_url')?>/assets/css/ie8-style.css" type="text/css" />
<![endif]-->
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>
示例12: test_main_feed
function test_main_feed()
{
self::factory()->post->create();
// @test_404
$types = array('rss2', 'rss', 'atom');
foreach ($types as $type) {
$this->go_to(get_feed_link($type));
$this->assertQueryTrue('is_feed');
}
}
示例13: jw_baiping
function jw_baiping($post_id)
{
$baiduXML = 'weblogUpdates.extendedPing' . get_option('blogname') . ' ' . home_url() . ' ' . get_permalink($post_id) . ' ' . get_feed_link() . ' ';
$wp_http_obj = new WP_Http();
$return = $wp_http_obj->post('http://ping.baidu.com/ping/RPC2', array('body' => $baiduXML, 'headers' => array('Content-Type' => 'text/xml')));
if (isset($return['body'])) {
if (strstr($return['body'], '0')) {
$noff_log = 'succeeded!';
} else {
$noff_log = 'failed!';
}
} else {
$noff_log = 'failed!';
}
}
示例14: feed_links
/**
* Display the links to the general feeds.
*
* @since 2.8.0
*
* @param array $args Optional arguments.
*/
function feed_links($args = array())
{
if (!current_theme_supports('automatic-feed-links')) {
return;
}
$defaults = array('separator' => _x('»', 'feed link'), 'feedtitle' => __('%1$s %2$s Feed'), 'comstitle' => __('%1$s %2$s Comments Feed'));
$args = wp_parse_args($args, $defaults);
/**
* Filter whether to display the posts feed link.
*
* @since 4.4.0
*
* @param bool $show Whether to display the posts feed link. Default true.
*/
if (apply_filters('feed_links_show_posts_feed', true)) {
echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr(sprintf($args['feedtitle'], get_bloginfo('name'), $args['separator'])) . '" href="' . esc_url(get_feed_link()) . "\" />\n";
}
/**
* Filter whether to display the comments feed link.
*
* @since 4.4.0
*
* @param bool $show Whether to display the comments feed link. Default true.
*/
if (apply_filters('feed_links_show_comments_feed', true)) {
echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr(sprintf($args['comstitle'], get_bloginfo('name'), $args['separator'])) . '" href="' . esc_url(get_feed_link('comments_' . get_default_feed())) . "\" />\n";
}
}
示例15: ajax_read_url
static function ajax_read_url()
{
return add_query_arg('p2ajax', 'true', get_feed_link('p2.ajax'));
}