Skip to content

Instantly share code, notes, and snippets.

@wvega
Last active August 29, 2015 14:02
Show Gist options
  • Save wvega/23d5bb56b6ad1bab2dd1 to your computer and use it in GitHub Desktop.
Save wvega/23d5bb56b6ad1bab2dd1 to your computer and use it in GitHub Desktop.
Categories List Walke wrapper function for WEN Team (AWPCP's Issue #833)
<?php
function wen_shortcode_awpcp_list_categories( $atts ) {
// unused
extract( shortcode_atts( array(
'type' => 'page',
'value' => '1',
'input' => 'id',
), $atts ) );
if ( ! function_exists( 'awpcp_categories_collection' ) ) {
return '';
}
if ( ! class_exists( 'WEN_CategoriesListWalker' ) ) {
return '';
}
if ( ! class_exists( 'AWPCP_CategoriesRenderer' ) ) {
return '';
}
$categories = awpcp_categories_collection();
$walker = new WEN_CategoriesListWalker();
$categories_renderer = new AWPCP_CategoriesRenderer( $categories, $walker );
$categories_list = $categories_renderer->render( array( 'show_listings_count' => false ) );
$output = '<div class="widget_nav_menu"><ul class="dropdown-menu">[categories-list]</ul></div>';
$output = str_replace( '[categories-list]', $categories_list, $output );
return $output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment