• Resolved wwwrich

    (@wwwrich)


    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!

    Rich

    https://www.ads-software.com/plugins/wp-rss-aggregator/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Miguel Muscat

    (@mekku)

    @wwwrich,

    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;
    Thread Starter wwwrich

    (@wwwrich)

    Thanks very much :]

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Echoing something if the feed returns no posts’ is closed to new replies.