Loop API & functions

Four global functions. That's the whole public PHP surface.

thewpfeeds( string $feed_slug ): ItemCollection

The loop API. Returns the feed's cached items as an iterable, countable collection of Item objects — never blocks on the remote API (stale items are served and a background refresh queued; see Caching). Unknown slug → empty collection, never an error.

$items = thewpfeeds( 'linkedin-main' );

if ( ! $items->isEmpty() ) {
    foreach ( $items->take( 3 ) as $item ) {
        // render
    }
}

ItemCollection implements IteratorAggregate and Countable, plus take( $n ), isEmpty(), and all().

thewpfeeds_render( string $feed_slug, array $args = [] ): void

Full template-chain render: feed.phplayout-{layout}.php → item hierarchy. What the block uses internally, available to any theme.

thewpfeeds_render( 'yt-tutorials', [
    'layout' => 'carousel',   // resolves layout-carousel.php through the chain
    'count'  => 6,            // overrides the feed's item count
] );

An empty (or never-fetched) feed renders empty.php — which shows error details only to users with manage_options and nothing to visitors.

thewpfeeds_item( Item $item, Feed $feed ): void

Renders one item through the item hierarchy (item-{feed-slug}item-{provider}item). Layouts call it per item; use it in custom layouts or anywhere you have an Item in hand.

thewpfeeds_template( string $name, array $vars = [] ): void

get_template_part() for The WP Feeds templates: resolves $name.php through child theme → parent theme → plugin and extracts $vars into scope. For composing partials inside your overrides:

// inside {theme}/thewpfeeds/item.php
thewpfeeds_template( 'item-footer', [ 'item' => $item ] );
// looks for {theme}/thewpfeeds/item-footer.php

WP-CLI

wp thewpfeeds status                     # all feeds + cache age + last error
wp thewpfeeds fetch <slug> [--force]     # run the full fetch pipeline now

fetch --force bypasses the fetch lock — the smoke test for provider config, credentials, and templates in one command.