| | |
| | | } |
| | | |
| | | use JVBase\managers\CacheManager; |
| | | use JVBase\meta\Meta; |
| | | |
| | | add_filter('jvb_base', function () { |
| | | return 'ajv_'; |
| | |
| | | } |
| | | return $base.JVB()->blocks()->render_core_post_content($block, $content); |
| | | } |
| | | |
| | | add_filter('the_seo_framework_meta_render_data', 'ajvb_no_next_archive', 10, 1); |
| | | function ajvb_no_next_archive($tags) { |
| | | if (is_tax() || is_post_type_archive()) { |
| | | if (array_key_exists('next', $tags)) { |
| | | unset($tags['next']); |
| | | } |
| | | } |
| | | return $tags; // Keep the link for other pages |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | add_filter('jvbSummaryDetailsOutput', 'ajvb_summary_info',10, 1); |
| | | function ajvb_summary_info(string $return):string |
| | | { |
| | | if (!is_singular(array_map(function($item) { return BASE.$item;}, array_keys(JVB_CONTENT)))) { |
| | | return $return; |
| | | } |
| | | |
| | | $return = ajvb_term_list(); |
| | | $return .= ajvb_meta_output(); |
| | | |
| | | return $return; |
| | | } |
| | | |
| | | function ajvb_term_list():string |
| | | { |
| | | if (!JVB_TAXONOMY){ |
| | | return ''; |
| | | } |
| | | $ID = get_the_ID(); |
| | | $type = jvbNoBase(get_post_type($ID)); |
| | | $taxonomies = array_filter(JVB_TAXONOMY, function($config) use ($type){ |
| | | return in_array($type, $config['for_content']); |
| | | }); |
| | | |
| | | $lists = []; |
| | | foreach ($taxonomies as $taxonomy => $config) { |
| | | $terms = wp_get_object_terms($ID, $taxonomy); |
| | | if ($terms && !is_wp_error($terms)) { |
| | | $list = sprintf( |
| | | '<li>%s<span>%s</span><ul class="term-list">', |
| | | jvbIcon($config['icon']), |
| | | $config['plural'] |
| | | ); |
| | | foreach ($terms as $term) { |
| | | $list .= sprintf( |
| | | '<li><a href="%s" rel="tag">%s</a></li>', |
| | | get_term_link($term), |
| | | $term->name |
| | | ); |
| | | } |
| | | $list .='</ul></li>'; |
| | | $lists[] = $list; |
| | | } |
| | | } |
| | | $out =''; |
| | | if (!empty($lists)){ |
| | | $out = sprintf( |
| | | '<ul class="ajv-term-list">%s</ul>', |
| | | implode('',$lists) |
| | | ); |
| | | } |
| | | |
| | | return $out; |
| | | |
| | | } |
| | | |
| | | function ajvb_meta_output():string |
| | | { |
| | | if (!class_exists('JVBase\meta\Meta')) { |
| | | return ''; |
| | | } |
| | | $ID = get_the_ID(); |
| | | $type = jvbNoBase(get_post_type($ID)); |
| | | |
| | | return apply_filters('ajvb_summary_meta_output', '', $type); |
| | | } |
| | | |
| | | function ajvb_format_needs(array $needs):string |
| | | { |
| | | $theNeeds = ''; |
| | | foreach ($needs as $need) { |
| | | $theNeeds .= sprintf( |
| | | '<li><h3>%s</h3>%s<div class="info">%s</div></li>', |
| | | $need['need'], |
| | | $need['image'] !== '' ? jvbFormatImage($need['image']) : '', |
| | | $need['fulfilled'] |
| | | ); |
| | | } |
| | | return sprintf( |
| | | '<section id="needs"><h2>What we needed:</h2><ul class="needs-wants">%s</ul></section>', |
| | | $theNeeds |
| | | ); |
| | | } |
| | | |
| | | function ajvb_format_wants(array $wants):string |
| | | { |
| | | $theWants = ''; |
| | | foreach ($wants as $want) { |
| | | $theWants .= sprintf( |
| | | '<li><h3>%s</h3>%s<div class="info">%s</div></li>', |
| | | $want['need'], |
| | | $want['image'] !== '' ? jvbFormatImage($want['image']) : '', |
| | | $want['fulfilled'] |
| | | ); |
| | | } |
| | | return sprintf( |
| | | '<section id="wants"><h2>What we wanted:</h2><ul class="needs-wants">%s</ul></section>', |
| | | $theWants |
| | | ); |
| | | } |