Пример #1
0
function register_custom_post_types()
{
    $event = new VernacularPostType('event');
    $event->register();
    $workshop = new VernacularPostType('workshop');
    $workshop->labels('Class', 'Classes');
    $workshop->register();
}
Пример #2
0
    {
        $this->title = 'Latest Post';
        $this->id = 'ortlieb-latest';
        $this->setup();
    }
    function widget($args, $instance)
    {
        $this->render_template($args, $instance, 'latest_post.php');
    }
    function form($instance)
    {
        $this->setup_form($instance);
        $this->textfield('title', 'Title');
    }
}
$dealers = new VernacularPostType('dealer');
$dealers->labels('Dealer', 'Dealers');
$dealers->register();
define(DEALER_API_ENDPOINT, '/index.php/?json=get_recent_posts&post_type=dealer&count=-1&include=id,title,custom_fields');
add_filter('json_api_encode', 'json_api_encode_acf');
function json_api_encode_acf($response)
{
    if (isset($response['posts'])) {
        foreach ($response['posts'] as $post) {
            json_api_add_acf($post);
            // Add specs to each post
        }
    } else {
        if (isset($response['post'])) {
            json_api_add_acf($response['post']);
            // Add a specs property