cache = CacheManager::for('timelines', WEEK_IN_SECONDS)->connectTo('post', 'timeline'); add_action('init', [ $this, 'registerBlock' ]); add_action('wp_footer', 'jvbRenderGallery'); } public function registerBlock() { register_block_type($this->path, [ 'render_callback' => [ $this, 'render' ] ]); } public function render(array $attributes, string $content, WP_Block $block) { global $post; if (!$post || !Features::forContent(jvbNoBase($post->post_type))->has('is_timeline') ) { return ''; } $this->parentID = $post->ID; $cache = $this->cache->get($this->parentID); if ($cache) { return $cache; } $this->content = jvbNoBase($post->post_type); $this->children = get_children([ 'post_parent' => $this->parentID, 'post_status' => 'publish', 'orderby' => 'date', 'order' => 'ASC', 'fields' => 'ids' ]); $this->total = count($this->children); ob_start(); $this->renderBlock(); $content = ob_get_clean(); $this->cache->set($this->parentID, $content); return $content; } protected function renderBlock():void { $this->renderHeader(); $this->renderTimeline(); } protected function renderHeader():void { $title = get_the_title(); ?>

Before and After Laser Tattoo Removal:

Before

parentID), 'tiny', 'large', false) ?>

After total?> Treatmenttotal > 1 ? 's' : '' ?>

children[count($this->children)-1]), 'tiny', 'large', false) ?>
children; array_unshift($all, $this->parentID); $uniqueFields = JVB()->routes('content')->getTimelineUniqueFields($this->content); foreach ($all as $i => $ID) { $meta = new MetaManager($ID, 'post'); $fields = $meta->getAll($uniqueFields); $plural = ($i>1) ? 's': ''; $title = ($i === 0) ? 'Before Laser Tattoo Removal' : 'After '.$i.' Treatment'.$plural; $title = ($i > 0 && !str_contains('Treatment', $fields['post_title'])) ? $fields['post_title'] : $title; ?>

'.date('F Y', strtotime($fields['post_date'])).'' : '' ?> outputTimelineTax($ID) : '' ?> '.wptexturize(wp_kses_post( wpautop($fields['post_content']))).'
' : '' ?>
'; foreach ($timeline as $term) { $link = get_term_link($term->term_id, BASE.'timeline'); $out .= '
  • '; } $out .=''; return $out; } }