The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

WP RSS Aggregator
[resolved] Echoing something if the feed returns no posts (3 posts)

  1. wwwrich
    Posted 2 years ago #

    Hi there,

    I have been using this plugin and found it really useful.

    What I am trying to do is work out a way of creating a function which echos something if the WP RSS Aggregator plugin has posts and echo something else if there are no posts.

    For example if there are posts being displayed by WP RSS Aggregator for a job website I could echo 'We're hiring' or 'No vacancies available' if no posts are retuned.

    I have been looking through the documentation and cant find anywhere to help me out. I'm a bit of a php noob though, so if anyone can point me in the right direction that would be great!



  2. Miguel
    Plugin Author

    Posted 2 years ago #


    If you wish to check from ALL feed sources, and not just one feed source, you use the following code:

    $job_count = wp_count_posts( 'wprss_feed_item' );
    $published_job_count = intval( $job_count->publish );

    If you are bringing in your jobs from only ONE feed source, you can use this code to get the feed item from that source. The parameter of the function is the ID of the feed source that brings in the job feed items.

    $job_feeds = wprss_get_feed_items_for_source( $feed_source_id );
    $job_count = $job_feeds->post_count;
  3. wwwrich
    Posted 2 years ago #

    Thanks very much :]

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP RSS Aggregator
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic