• Hi,

    our network uses a self-written-plugin to get posts from another system.
    Is there any kind of API that we can use to broadcast these posts automatically to another blog?

    Like:
    // Fetching data and creating a new post
    $test = new Broadcast;
    $test->broadcastToBlog(ID of the new Topic, Target-Blog);

    That would be great. Currently we have to post it manually every time we get new posts into the main blog.

    Greetings from Germany,
    Lukas

    https://wordpress.org/plugins/threewp-broadcast/

Viewing 1 replies (of 1 total)
  • Plugin Author edward_plainview

    (@edward_plainview)

    I’m aware of the fact that Broadcast is missing proper documentation and a nice API. This is in the works. In the meantime, here is some code adapted from the ACF Broadcast plugin:

    $broadcasting_data = new broadcasting_data();
    $broadcasting_data->custom_fields = true;
    $broadcasting_data->taxonomies = true;
    $broadcasting_data->link = true;
    $broadcasting_data->parent_blog_id = $parent_blog_id;
    $broadcasting_data->parent_post_id = $parent_post_id;
    $broadcasting_data->post = $parent_post;

    // Repeat this several times…
    $blog = new \threewp_broadcast\broadcast_data\blog;
    $blog->id = $child_blog_id;
    $broadcasting_data->broadcast_to( $blog );

    $broadcast = \threewp_broadcast\ThreeWP_Broadcast::instance();
    $broadcast->broadcast_post( $broadcasting_data );

    It should be enough to get you started. 🙂

Viewing 1 replies (of 1 total)

The topic ‘API for Broadcasting?’ is closed to new replies.