WordPress.org

Ready to get started?Download WordPress

Forums

HungryFEED
Filter by title only (3 posts)

  1. cplummer4
    Member
    Posted 1 year ago #

    Hello,

    The current 'filter' option appears to allow keyword filtering on 'items'. Each item includes both the title and description fields. Is there a way to filter by titles only?

    I'm wanting to provide 5 filtered views of the same RSS feed for a radio blog. They are consistent with naming the radio show titles. However, sometimes they talk about other radio shows within the description of a particular show. So the filtering mechanism is breaking down.

    Thanks,
    Casey

    http://wordpress.org/extend/plugins/hungryfeed/

  2. cplummer4
    Member
    Posted 1 year ago #

    I was able to fix this, but I only needed to filter by titles, and didn't care about descriptions.

    Edit hungryfeed.php:

    // if any filters were specified, then only show the feed items that contain the filter text
    		if (count($filters))
    		{
    			$match = false;
    			$item_will_be_included = false;
    
    			foreach($filters as $f)
    			{
    				// Filter on titles only
    				// if (stripos($description,$f) !== false || stripos($title,$f) !== false)
    				if (stripos($title,$f) !== false)
    				{
    					$match = true;
    					break;
    				}
    			}
    
    			if (!$match)
    			{
    				// didn't match the filter, exit the foreach loop
    				continue;
    			}
    		}
  3. Jason
    Member
    Plugin Author

    Posted 1 year ago #

    looks good, an improvement that might make sense for a future version would be to add that in as a parameter like "filter_title_only"

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags