Closed neilberry001 closed 11 years ago
@neilberry001 Should be included as separate partial within the main sidebar.php
template as it might need to be included in different (custom) sidebar templates. So yes should sit alongside (above) the two widget area calls.
We rarely use widgets but should we need to then it's important they are there.
<aside class="menu-sub">
<h4 class="menu-sub__heading"><?php echo esc_html($section_title); ?></h4>
<ul class="nav-sub">
<?php echo $children; ?>
</ul>
</aside>
Wondering whether we should consider creating a function which generates navigation based on a CPT being based in.
Note:
makes all lowercase
Sidebar for Custom Post Types
<?php
$pt_obj = get_post_type_object( 'accommodation' );
//requires cpt to be defined as 'hierarchical' => true
$args = array(
'post_type'=>$pt_obj->name,
'title_li'=> false,
'echo'=>0
);
$list_pages = wp_list_pages( $args );
$section_title = $pt_obj->name;
?>
<?php if( $list_pages ) : ?>
<aside class="menu-sub">
<h4 class="menu-sub__heading"><?php echo ucwords(esc_html($section_title)); ?></h4>
<ul class="nav-sub">
<?php echo $list_pages; ?>
</ul>
</aside>
<?php endif; ?>
These two options should be need matching. cpt option uses $args not string, would be nice to have them match.
further: Categories List:
<?php
$args = array (
'echo' =>0,
'title_li' =>false,
);
$categories_list= wp_list_categories( $args );
$section_title = 'Categories';
?>
<?php if( $categories_list ) : ?>
<aside class="menu-sub">
<div class="menu-secondary">
<h4 class="menu-sub__heading"><?php echo ucwords(esc_html($section_title)); ?></h4>
<ul class="nav-sub">
<?php echo $categories_list; ?>
</ul>
</div>
</aside>
<?php endif; ?>
further Archive List:
<?php
$args = array (
'echo' =>0,
'title_li' =>false,
);
$categories_list= wp_get_archives( $args );
$section_title = 'Archives';
?>
<?php if( $categories_list ) : ?>
<aside class="menu-sub">
<div class="menu-secondary">
<h4 class="menu-sub__heading"><?php echo ucwords(esc_html($section_title)); ?></h4>
<ul class="nav-sub">
<?php echo $categories_list; ?>
</ul>
</div>
</aside>
<?php endif; ?>
This should allow us to build a consistent sidebar with all options available as default in Tanlinell.
It is advised that the above blocks be commented for documentation and 'prettified' so are consistent with each other.
Should this be included in addition to the already in place code for widget pull. Or should this become the only contents? @getdave