'Before & After', 'plural' => 'Before & Afters', 'dash_title' => 'Progress', 'dash_description' => 'Manage your before and after posts', 'breadcrumb' => 'Before & Afters', 'capability_type' => ['progress', 'progress'], 'hide_children' => true, 'is_timeline' => true, 'show_feed' => true, 'hierarchical' => true, 'icon' => 'arrows-left-right', 'rewrite' => [ 'slug' => 'before-and-after', 'with_front' => false, ], 'sections' => [ 'progression' => [ 'label' => 'Progression', ] ], 'seo' => [ 'schema' => [ 'type' => 'BeforeAfter', 'name' => '{{post_title}}', 'description' => '{{post_excerpt}}', 'about' => ['@id' => '{{site_url}}/#laser-removal-service'], 'temporalCoverage' => '{{post_date}}/{{last_date}}', 'additionalProperty' => [ ['name' => 'Number of sessions', 'value' => '{{number.name}}'], ['name' => 'Treatment area', 'value' => '{{body-part.name}}'], ], 'associatedMedia' => '{{timeline_photos}}', // parent post thumbnail = before; each child post has a post thumbnail, too ], 'meta' => [ 'title' => '{{body-part.name}} Laser Tattoo Removal – Before & After', 'description' => 'Documented progress of {{body-part.name}} laser tattoo removal over {{number.name}} sessions.', ], 'archive' => [ 'type' => 'CollectionPage', 'name' => 'Tattoos Before and After Laser Tattoo Removal', ], ], 'feed' => [ 'single' => [ 'pre_title' => 'Before & After Laser Tattoo Removal', ], 'archive' => [ ], 'config' => [ 'is_gallery' => false, 'content' => 'progress', 'context' => 'progress', 'id' => [], 'class' => [], ] ], 'fields' => [ 'post_title' => [ 'type' => 'text', 'label' => 'Title', 'quickEdit' => true, 'section' => 'progression', 'for_all' => true, ], 'post_status' => [ 'type' => 'radio', 'label' => 'Status', 'options' => [ 'publish' => 'Show', 'draft' => 'Hide', 'trash' => 'Scrap', 'delete' => 'Permanently Delete' ], 'section' => 'progression', 'for_all' => true, ], 'post_date' => [ 'type' => 'date', 'label' => 'Date', 'for_all' => true, ], 'post_thumbnail' => [ 'type' => 'upload', 'label' => 'Image', 'quickEdit' => true, 'section' => 'progression', 'for_all' => true, ], 'person' => [ 'type' => 'taxonomy', 'taxonomy' => 'person', 'autocomplete' => true, 'label' => 'Person', 'quickEdit' => true, 'createNew' => true, 'section' => 'progression', 'hint' => 'Not public, just to make it easier to find' ], 'goal' => [ 'type' => 'taxonomy', 'taxonomy' => 'goal', 'autocomplete' => true, 'label' => 'Goal', 'quickEdit' => true, 'createNew' => true, 'section' => 'progression' ], 'timeline' => [ 'type' => 'taxonomy', 'taxonomy' => 'timeline', 'autocomplete' => true, 'label' => 'Timeline', 'quickEdit' => true, 'createNew' => true, 'section' => 'progression', 'for_all' => true, ], 'body-part' => [ 'type' => 'taxonomy', 'taxonomy' => 'body-part', 'label' => 'Body Part', 'autocomplete' => true, 'quickEdit' => true, 'createNew' => true, 'section' => 'progression' ], 'style' => [ 'type' => 'taxonomy', 'taxonomy' => 'style', 'autocomplete' => true, 'label' => 'Tattoo Style', 'quickEdit' => true, 'createNew' => true, 'section' => 'progression' ], 'skin-type' => [ 'type' => 'taxonomy', 'taxonomy' => 'skin-type', 'label' => 'Skin Type', 'autocomplete' => true, 'quickEdit' => true, 'createNew' => true, 'section' => 'progression' ], 'age' => [ 'type' => 'taxonomy', 'taxonomy' => 'age', 'autocomplete' => true, 'label' => 'Age of Tattoo', 'quickEdit' => true, 'createNew' => true, 'section' => 'progression' ], 'number' => [ 'type' => 'taxonomy', 'taxonomy' => 'number', 'autocomplete' => true, 'label' => 'Number of Treatments', 'quickEdit' => true, 'createNew' => true, 'section' => 'progression' ], 'post_content' => [ 'type' => 'textarea', 'quill' => true, 'label' => 'Notes', 'section' => 'progression', 'for_all' => true, ] ], 'upload_title' => 'Upload Before & Afters', ]; } add_filter('jvbFeedItem', 'altr_progress_item', 10, 2); function altr_progress_item(string $out, array $config):string { if (!in_array('progress', $config['content'])) { return $out; } ob_start(); ?>
Before After

Started:

Last treated:

Total Treatments:

routes('content'); global $post; $data = $route->formatTimeline($post); $timeline = $data['fields']['timeline']; $total = count($timeline); if ($total === 1) { return $out; } $total--; $first = 'Before'.jvbFormatImage($timeline[0]['post_thumbnail'],'tiny','medium',false); $last = 'After '.$total.' Tx'.jvbFormatImage($timeline[$total]['post_thumbnail'],'tiny','medium',false); return $first.$last; } add_filter('jvbSEOResolveVariable', 'altr_progress_variables', 10, 6); function altr_progress_variables(mixed $return, string $variable, ?int $ID, ?string $objectType, ?string $contentType, ?MetaManager $meta):mixed { if ($contentType !== 'progress' || !in_array($variable, ['timeline_photos', 'last_date'])) { return $return; } $children = get_children([ 'post_parent' => $ID, 'post_status' => 'publish', 'order_by' => 'date', 'fields' => 'ids' ]); //Insert the parent to the beginning array_unshift($children, $ID); if ($variable === 'timeline_photos') { return array_map(function ($item) { return get_post_thumbnail_id($item); }, $children); } // $variable === 'last_date' return get_the_date('c', $children[array_key_last($children)]); }