Files
sean 0e8a8b3028
Some checks are pending
deploy-testing / deploy (push) Waiting to run
Initial testing snapshot
2026-11-17 16:15:01 -05:00

51 lines
1.5 KiB
PHP

<?php
/**
* This file contains functions that extend the core's custom RSS feed.
*
* @since 1.6
*/
add_action( 'wprss_custom_feed_entry', 'wprss_et_extend_custom_feed' );
/**
* Extends the custom feed for each entry to include the thumbnails.
*
* @since 1.6
*/
function wprss_et_extend_custom_feed( $feed_item_id ) {
// Get the thumbnail settings
$thumbnails_settings = get_option( 'wprss_settings_thumbnails' );
// Check if thumbnails are enabled
$thumbnails_enabled = $thumbnails_settings['thumbnails_enable'];
$thumbnails_enabled = strcasecmp( $thumbnails_enabled, 'true' ) == 0
|| strcasecmp( $thumbnails_enabled, '1' ) == 0
|| strcasecmp( $thumbnails_enabled, 'on' ) == 0
|| strcasecmp( $thumbnails_enabled, 'yes' ) == 0;
// If Thumbnails enabled
if ( $thumbnails_enabled === TRUE ) {
// Get the thumbnail for the feed item
$thumbnail_img = get_post_meta( $feed_item_id, 'wprss_item_thumbnail', true );
// IF feed item has no thumbnail
if ( empty( $thumbnail_img ) ) {
// If a default is set, use the default image
// Otherwise, use the image that comes with the plugin
if ( !empty( $thumbnails_settings['default_thumbnail'] ) ) {
$thumbnail_img = $thumbnails_settings['default_thumbnail'];
} else {
$thumbnail_img = WPRSS_ET_IMG . 'default-thumbnail.png';
}
}
$width = $thumbnails_settings['thumbnail_width'];
$height = $thumbnails_settings['thumbnail_height'];
echo "<media:thumbnail url=\"$thumbnail_img\" width=\"$width\" height=\"$height\" />";
}
// END OF FUNCTION
}