| | |
| | | string $name = '', |
| | | string $url = '', |
| | | string $ID = '', |
| | | $extra = false |
| | | ?array $extra = null |
| | | ):array { |
| | | if ($name == '') { |
| | | $name = get_the_title(); |
| | |
| | | return $this->cache->remember( |
| | | $cacheKey, |
| | | function() use ($slug, $type, $registrar, $config, $paged) { |
| | | $out = '<h1>' . $this->directoryTitle($registrar) . '</h1>'; |
| | | |
| | | $out = '<h1>' . $config['title'] . '</h1>'; |
| | | $out .= '<div class="description">'; |
| | | foreach ($config['description'] ?? [] as $p) { |
| | | $out .= '<p>' . $p . '</p>'; |
| | | } |
| | | $out .= '</div>'; |
| | | $link = match($registrar->getType()) { |
| | | 'post' => get_post_type_archive_link($registrar->getBased()), |
| | | 'term' => false, |
| | | 'user' => get_post_type_archive_link($registrar->getProfile()->getBased()), |
| | | default => false, |
| | | }; |
| | | $out .= $link ? '<ul class="buttons"><li><a href="'.$link.'">See All</a></li></ul>' : ''; |
| | | $out .= $this->renderIndex($slug); |
| | | |
| | | $list = []; |
| | |
| | | |
| | | $get = new WP_Query($args); |
| | | |
| | | $hasExtra = $registrar->hasFeature('directory_extra'); |
| | | $hasExtra = !empty($config['directory_extra']??[]); |
| | | if ($get->have_posts()) { |
| | | while ( $get->have_posts() ) { |
| | | $get->the_post(); |
| | |
| | | foreach ($items as $item) { |
| | | $extra = ''; |
| | | if (!empty($item['extra'])) { |
| | | $extra = '<span>'; |
| | | $extra = '<ul class="term-list row">'; |
| | | foreach ($item['extra'] as $ext) { |
| | | $icon = Registrar::getInstance($ext['type'])->getIcon(); |
| | | $umamiType = ($ext['type'] === BASE.'shop') ? 'click_shop' : 'click_taxonomy'; |
| | | $extra .= '<a href="'.$ext['url'].'"'.$umami->trackContentClick($item['id'],$umamiType, ['source_type' => 'directory']).'>'.$ext['name'].'</a>'; |
| | | $extra .= '<li><a href="'.$ext['url'].'"'.$umami->trackContentClick($item['id'],$umamiType, ['source_type' => 'directory']).'>'.jvbIcon($icon).$ext['name'].'</a></li>'; |
| | | } |
| | | $extra .= '</span>'; |
| | | $extra .= '</ul>'; |
| | | } |
| | | |
| | | $item_html = apply_filters('jvb_directory_render_item', '', $item, $type, $extra); |