# top-10/4.4.1/includes/frontend/class-feed.php

WebberZone Top 10 — Popular Posts, version 4.4.1. 96 lines.

- Page: https://pluginprobe.com/plugins/top-10/4.4.1/code/includes/frontend/class-feed.php
- Raw: https://pluginprobe.com/plugins/top-10/4.4.1/raw/includes/frontend/class-feed.php
- Modified: 2026-07-25T17:51:42+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/top-10/4.4.1/code/includes/frontend/class-feed.php#L10-L20`.

```php
<?php
/**
 * Feed class.
 *
 * @package WebberZone\Top_Ten\Frontend
 */

namespace WebberZone\Top_Ten\Frontend;

use WebberZone\Top_Ten\Util\Hook_Registry;

if ( ! defined( 'WPINC' ) ) {
	die;
}

/**
 * Admin Columns Class.
 *
 * @since 3.3.0
 */
class Feed {

	/**
	 * Constructor class.
	 *
	 * @since 3.3.0
	 */
	public function __construct() {
		Hook_Registry::add_action( 'init', array( $this, 'pop_posts_feed' ) );
	}

	/**
	 * Add custom feeds for the overall and daily popular posts.
	 *
	 * @since 2.8.0
	 *
	 * @return void
	 */
	public function pop_posts_feed() {

		$popular_posts_overall = \tptn_get_option( 'feed_permalink_overall' );
		$popular_posts_daily   = \tptn_get_option( 'feed_permalink_daily' );

		if ( ! empty( $popular_posts_overall ) ) {
			add_feed( $popular_posts_overall, array( $this, 'pop_posts_feed_overall' ) );
		}
		if ( ! empty( $popular_posts_daily ) ) {
			add_feed( $popular_posts_daily, array( $this, 'pop_posts_feed_daily' ) );
		}
	}

	/**
	 * Callback for overall popular posts.
	 *
	 * @since 2.8.0
	 *
	 * @return void
	 */
	public function pop_posts_feed_overall() {
		$this->pop_posts_feed_callback( false );
	}

	/**
	 * Callback for daily popular posts.
	 *
	 * @since 2.8.0
	 *
	 * @return void
	 */
	public function pop_posts_feed_daily() {
		$this->pop_posts_feed_callback( true );
	}

	/**
	 * Callback function for add_feed to locate the correct template.
	 *
	 * @since 2.8.0
	 *
	 * @param bool $daily Daily posts flag.
	 *
	 * @return void
	 */
	public function pop_posts_feed_callback( $daily = false ) {

		set_query_var( 'daily', $daily );

		$template = locate_template( 'feed-rss2-popular-posts.php' );

		if ( ! $template ) {
			$template = TOP_TEN_PLUGIN_DIR . 'includes/frontend/feed-rss2-popular-posts.php';
		}

		load_template( $template );
	}
}

```
