Function Reference: geodir_add_nav_menu_items
Summary
Returns listing nav menu Items.
Description
When WP Admin ->
Geodirectory ->
Design ->
Navigation ->
Show add listing navigation in menu and/or Show listings navigation in menu
checked this function returns listing and add listing links.
Package
GeoDirectory
Return Values
- (string)
- The Menu HTML.
Change Log
Since: 1.0.0
Filters
‘geodir_menu_li_class’ [Line: 63]
‘geodir_menu_a_class’ [Line: 69]
‘geodir_menu_li_class’ [Line: 91]
‘geodir_sub_menu_li_class’ [Line: 98]
‘geodir_sub_menu_ul_class’ [Line: 104]
‘geodir_menu_a_class’ [Line: 110]
‘geodir_sub_menu_a_class’ [Line: 116]
‘geodir_menu_li_class’ [Line: 187]
‘geodir_menu_a_class’ [Line: 193]
‘geodir_menu_li_class’ [Line: 221]
‘geodir_sub_menu_li_class’ [Line: 228]
‘geodir_sub_menu_ul_class’ [Line: 234]
‘geodir_menu_a_class’ [Line: 240]
‘geodir_sub_menu_a_class’ [Line: 246]
‘geodir_menu_li_class’ [Line: 272]
Source File
geodir_add_nav_menu_items() is located in geodirectory-functions/taxonomy_functions.php [Line: 34]
Source Code
function geodir_add_nav_menu_items() { $items = ''; // apply filter to add more navigations // -Filter-Location-Manager if (get_option('geodir_show_listing_nav')) { $menu_class = ''; if (geodir_is_page('listing')) $menu_class = 'current-menu-item'; //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION $post_types = geodir_get_posttypes('object'); $show_post_type_main_nav = get_option('geodir_add_posttype_in_main_nav'); if (!empty($post_types)) { foreach ($post_types as $post_type => $args) { if (!empty($show_post_type_main_nav)) { if (in_array($post_type, $show_post_type_main_nav)) { if (get_post_type_archive_link($post_type)) { $menu_class = ''; if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) $menu_class = 'current-menu-item'; /** * Filter the menu li class. * * @since 1.0.0 * @param string $menu_class The menu HTML class. */ $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); /** * Filter the menu a class. * * @since 1.0.0 */ $a_class = apply_filters('geodir_menu_a_class', ''); $items .= '
- ';
$post_types = geodir_get_posttypes('object');
$show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav');
if (!empty($post_types)) {
global $geodir_add_location_url;
$geodir_add_location_url = true;
foreach ($post_types as $post_type => $args) {
if (!empty($show_listing_post_types)) {
if (in_array($post_type, $show_listing_post_types)) {
if (get_post_type_archive_link($post_type)) {
$menu_class = '';
if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing'))
$menu_class = 'current-menu-item';
$items .= '
- ' . __(geodir_utf8_ucfirst($args->labels->name),'geodirectory') . ' '; } } } } $geodir_add_location_url = NULL; } $items .= '
- ';
$post_types = geodir_get_posttypes('object');
$show_add_listing_post_types = get_option('geodir_add_listing_link_add_listing_nav');
if (!empty($post_types)) {
foreach ($post_types as $post_type => $args) {
if (!empty($geodir_allow_posttype_frontend)) {
if (in_array($post_type, $geodir_allow_posttype_frontend)) {
if (!empty($show_add_listing_post_types)) {
if (in_array($post_type, $show_add_listing_post_types)) {
if (geodir_get_addlisting_link($post_type)) {
$menu_class = '';
if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing'))
$menu_class = 'current-menu-item';
/**
* Filter the menu li class.
*
* @since 1.0.0
* @param string $menu_class The menu HTML class.
*/
$li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class);
$cpt_name = __($args->labels->singular_name, 'geodirectory');
$items .= '
- ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . ' '; } } } } } } } $items .= '