Winden 1.0

Meta Box Views

MB Views is an extension for Meta Box, which helps you to get Meta Box fields and build your templates on the front end fast and easily.

<?php

add_filter('f!winden/core/worker:compile_content_payload', 'example_mb_views_append_content_payload', 10);

/**
 * [Meta Box Views] Append the MB Views content to the payload.
 */
function example_mb_views_append_content_payload(string $content): string
{
    $posts = [];

    $query = new WP_Query([
        'posts_per_page' => -1,
        'post_type' => [
            'mb-views',
        ],
    ]);

    foreach ($query->posts as $post) {
        if (!empty(trim($post->post_content))) {
            $content .= $post->post_content;
        }
    }

    return $content;
}