| | |
| | | <?php |
| | | namespace JVBase\blocks; |
| | | |
| | | use JVBase\managers\CacheManager; |
| | | use JVBase\forms\TaxonomySelector; |
| | | use JVBase\managers\Cache; |
| | | use JVBase\meta\MetaManager; |
| | | use JVBase\utility\Features; |
| | | use WP_Block; |
| | | use WP_Query; |
| | | |
| | | if (!defined('ABSPATH')) { |
| | | exit; // Exit if accessed directly |
| | |
| | | |
| | | class TimelineBlock |
| | | { |
| | | protected CacheManager $cache; |
| | | protected Cache $cache; |
| | | protected string $config; |
| | | protected string $type; |
| | | protected string $path = JVB_DIR . '/build/timeline'; |
| | |
| | | |
| | | public function __construct() |
| | | { |
| | | $this->cache = CacheManager::for('timelines', WEEK_IN_SECONDS)->connectTo('post', 'timeline'); |
| | | $this->cache = Cache::for('timelines', WEEK_IN_SECONDS)->connect('post'); |
| | | if (JVB_TESTING){ |
| | | $this->cache->clear(); |
| | | $this->cache->flush(); |
| | | } |
| | | add_action('init', [ $this, 'registerBlock' ]); |
| | | add_action('wp_footer', 'jvbRenderGallery'); |
| | |
| | | ?> |
| | | |
| | | <?= $open ?> |
| | | <a href="<?=$link?>" rel="tag"><?=$term->name?></a> |
| | | <a href="<?=$link?>" rel="tag"><?=html_entity_decode($term->name)?></a> |
| | | <?= $close ?> |
| | | <?php } |
| | | if ($many) { echo '</ul>'; } |
| | |
| | | <?= jvbFormatImage(get_post_thumbnail_id($this->parentID), 'tiny', 'large', false) ?> |
| | | </div> |
| | | <div class="after"> |
| | | <?php if (!empty($this->children)) :?> |
| | | <h3>After <?=$this->total?> Treatment<?= $this->total > 1 ? 's' : '' ?></h3> |
| | | <?= jvbFormatImage(get_post_thumbnail_id($this->children[count($this->children)-1]), 'tiny', 'large', false) ?> |
| | | <?php endif; ?> |
| | | </div> |
| | | </section> |
| | | <section id="info"> |
| | |
| | | $out = '<ul class="term-list">'; |
| | | foreach ($timeline as $term) { |
| | | $link = get_term_link($term->term_id, BASE.'timeline'); |
| | | $out .= '<li><a href="'.$link.'" rel="tag" title="See more progressions at this timeline">'.jvbIcon(JVB_TAXONOMY['timeline']['icon']??'hourglass').$term->name.'</a><small>from the last treatment</small></li>'; |
| | | $out .= '<li><a href="'.$link.'" rel="tag" title="See more progressions at this timeline">'.jvbIcon(JVB_TAXONOMY['timeline']['icon']??'hourglass').html_entity_decode($term->name).'</a><small>after the treatment</small></li>'; |
| | | } |
| | | $out .='</ul>'; |
| | | return $out; |