I’ve found the solution by modifying yadawiki-frontend.php
function yada_wiki_toc_shortcode( $atts ) {
extract( shortcode_atts( array(
'show_toc' => '',
'category' => '',
'order' => '',
'children' => false
), $atts ) );
$show_toc = sanitize_text_field($show_toc);
$category = sanitize_text_field($category);
$order = sanitize_text_field($order);
$children = sanitize_text_field($children);
return get_yada_wiki_toc( $show_toc, $category, $order, $children );
}
function get_yada_wiki_toc( $show_toc, $category, $order, $children ){
$show_toc = trim($show_toc);
$category = trim($category);
$order = trim($order);
if($category != "") {
if($order == "") {
$order = "title";
}
$args = array(
'posts_per_page' => -1,
'offset' => 0,
'post_type' => 'yada_wiki',
'tax_query' => array(
array(
'taxonomy' => 'wiki_cats',
'field' => 'name',
'terms' => $category,
'include_children' => $children
),
),
'orderby' => $order,
'order' => 'ASC',
'post_status' => 'publish'
);
$cat_list = get_posts( $args );
$cat_output = '<ul>';
foreach ( $cat_list as $item ) {
$cat_output = $cat_output . '<li><a href="'.get_page_link($item->ID).'">'.$item->post_title.'</a></li>';
}
$cat_output = $cat_output . '</ul>';
return $cat_output;
}
else if($show_toc == true) {
$the_toc = get_page_by_title( html_entity_decode("toc"), OBJECT, 'yada_wiki');
$toc_status = get_post_status( $the_toc );
if( $toc_status == "publish" ) {
$the_content = apply_filters( 'the_content', $the_toc->post_content );
return $the_content;
}
}
}
Plugin Author
dmccan
(@dmccan)
Hi totalvamp, I’m not sure if it applies here, but when you have a wiki article that you assign to a sub-category, if you also assign it to a higher category then it might appear twice. I think WordPress automatically associates it with the higher category.
If that is not the case here then I’ll look at the change you posted (thank you!) so that it is added in the next update.
Hi thanks for the answer, yes that’s what I thought at first, but it wasn’t in there. It just grabbed all the children as well.
Now I just have to find a way for breadcrumbs to work like this
TOC > Families > Ashfall > current
so it’s easier to navigate.