RSS
extends RSS
in package
RSS functionality.
Adds custom feeds for:
- Complete site - including ingredients. Used for OneNote.
- Recipe excerpts. Used for sharing on Facebook and Twitter.
- Recipes complete. Used for Pinterest.
Tags
Table of Contents
Constants
- BACKLINK_CONTAINER = 'rss-backlink.php'
- The backlink container partial filename.
- FEED_COMPLETE = 'complete'
- Complete feed slug.
- FEED_RECIPES_COMPLETE = 'recipes-complete'
- Recipes complete feed slug.
- FEED_RECIPES_EXCERPT = 'recipes-excerpt'
- Recipes excerpt feed slug.
- IMAGE_CONTAINER = 'rss-image.php'
- Image content html.
- IMAGE_SIZE = 'medium'
- Default image size to use in feed.
- RECIPE_CATEGORY = 'recipes'
- Recipe category name.
Properties
- $backlink_container : string
- The fully qualified path to the backlink container partial.
- $image_container : string
- The fully qualified path to the featured image container partial.
- $instances : array<string|int, object>
- The array of instances of this class and sub-classes.
- $site_name : string
- Site name.
- $site_url : string
- Site url.
Methods
- add_custom_feeds() : void
- Add custom RSS feeds.
- add_media_thumbnail() : void
- Add featured image to RSS2 feed items as media:thumbnail meta data.
- append_backlink() : string
- Append backlink to feed contents - not excerpts.
- disable_comments_feed() : bool
- Disable comment feeds.
- do_custom_feed() : void
- Callback to render custom RSS2 feeds.
- filter_feed_title() : string
- Filter custom RSS2 feed titles.
- filter_image_size() : string
- Set image size to use in feed.
- filter_posts() : void
- Set content to include in custom feeds.
- filter_use_excerpt() : int
- Set excerpt or content explicitly for custom feeds.
- get_instance() : object
- Creates and/or returns the instance of this class.
- prepend_featured_image() : string
- Prepend featured image to feed contents and excepts.
- __construct() : void
- Initialise the class.
Constants
BACKLINK_CONTAINER
The backlink container partial filename.
protected
string
BACKLINK_CONTAINER
= 'rss-backlink.php'
This contains the text to be appended to an RSS entry with a backlink to the site home page.
Tags
FEED_COMPLETE
Complete feed slug.
protected
string
FEED_COMPLETE
= 'complete'
Tags
FEED_RECIPES_COMPLETE
Recipes complete feed slug.
protected
string
FEED_RECIPES_COMPLETE
= 'recipes-complete'
Tags
FEED_RECIPES_EXCERPT
Recipes excerpt feed slug.
protected
string
FEED_RECIPES_EXCERPT
= 'recipes-excerpt'
Tags
IMAGE_CONTAINER
Image content html.
protected
string
IMAGE_CONTAINER
= 'rss-image.php'
This contains the markup for the featured image to be prepended to an RSS entry.
Tags
IMAGE_SIZE
Default image size to use in feed.
protected
string
IMAGE_SIZE
= 'medium'
Tags
RECIPE_CATEGORY
Recipe category name.
protected
string
RECIPE_CATEGORY
= 'recipes'
Tags
Properties
$backlink_container
The fully qualified path to the backlink container partial.
protected
string
$backlink_container
= ''
Tags
$image_container
The fully qualified path to the featured image container partial.
protected
string
$image_container
= ''
Tags
$instances
The array of instances of this class and sub-classes.
protected
static array<string|int, object>
$instances
= array()
Tags
$site_name
Site name.
protected
string
$site_name
= ''
Used to create feed title.
Tags
$site_url
Site url.
protected
string
$site_url
= ''
Used to set backlink in feed items.
Tags
Methods
add_custom_feeds()
Add custom RSS feeds.
public
add_custom_feeds() : void
Tags
add_media_thumbnail()
Add featured image to RSS2 feed items as media:thumbnail meta data.
public
add_media_thumbnail() : void
Tags
append_backlink()
Append backlink to feed contents - not excerpts.
public
append_backlink(string $content) : string
Parameters
- $content : string
-
The feed content.
Tags
Return values
string —The content with appended backlink info.
disable_comments_feed()
Disable comment feeds.
public
disable_comments_feed(bool $show) : bool
Parameters
- $show : bool
-
Whether to show comment feeds.
Tags
Return values
bool —Always false to disable comment feeds.
do_custom_feed()
Callback to render custom RSS2 feeds.
public
do_custom_feed() : void
Tags
filter_feed_title()
Filter custom RSS2 feed titles.
public
filter_feed_title(string $feed_title) : string
Parameters
- $feed_title : string
-
The title of the feed.
Tags
Return values
string —The filtered feed title.
filter_image_size()
Set image size to use in feed.
public
filter_image_size(string $image_size) : string
Parameters
- $image_size : string
-
Standard image size.
Tags
Return values
string —The filtered image size.
filter_posts()
Set content to include in custom feeds.
public
filter_posts(WP_Query $query) : void
Parameters
- $query : WP_Query
-
The WP_Query instance (passed by reference).
Tags
filter_use_excerpt()
Set excerpt or content explicitly for custom feeds.
public
filter_use_excerpt(int $use_excerpt) : int
Parameters
- $use_excerpt : int
-
0 = content, 1 = excerpt.
Tags
Return values
int —The filtered excerpt flag.
get_instance()
Creates and/or returns the instance of this class.
public
static get_instance() : object
Tags
Return values
object —The instance of this class.
prepend_featured_image()
Prepend featured image to feed contents and excepts.
public
prepend_featured_image(string $content) : string
Parameters
- $content : string
-
The feed content.
Tags
Return values
string —The content with (possibly) prepended image markup.
__construct()
Initialise the class.
protected
__construct() : void