Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
added 106 characters in body
Source Link
Adeel
  • 11
  • 4

I have three levels of my menu created in custom walker class. Output is like below:

home (parent) about (parent) item 1 (level 1 child) item 1-1 (level 2 child) item 1-2 (level 2 child) services (parent) item 1 (level 1 child) item 1-1 (level 2 child) item 1-2 (level 2 child) item 2 (level 1 child) item 2-1 (level 2 child) item 2-2 (level 2 child)

  • home (parent)
  • about (parent)
  • item 1 (level 1 child)
    • item 1-1 (level 2 child)
    • item 1-2 (level 2 child)
  • services (parent)
  • item 1 (level 1 child)
    • item 1-1 (level 2 child)
    • item 1-2 (level 2 child)
  • item 2 (level 1 child)
    • item 2-1 (level 2 child)
    • item 2-2 (level 2 child)

I want to count only "level 1 childs" inside start_lvl() for each parent item individually.

In above example, output should be for about (1) and services (2) because "about" has only 1 child for level 1, and services has 2 childs for level 1

Please somebody help, I have searched a lot and tried almost all methods available on Stack Exchange, Overflow etc...

I have three levels of my menu created in custom walker class. Output is like below:

home (parent) about (parent) item 1 (level 1 child) item 1-1 (level 2 child) item 1-2 (level 2 child) services (parent) item 1 (level 1 child) item 1-1 (level 2 child) item 1-2 (level 2 child) item 2 (level 1 child) item 2-1 (level 2 child) item 2-2 (level 2 child)

I want to count only "level 1 childs" inside start_lvl()

In above example, output should be for about (1) and services (2) because "about" has only 1 child for level 1, and services has 2 childs for level 1

Please somebody help, I have searched a lot and tried almost all methods available on Stack Exchange, Overflow etc...

I have three levels of my menu created in custom walker class. Output is like below:

  • home (parent)
  • about (parent)
  • item 1 (level 1 child)
    • item 1-1 (level 2 child)
    • item 1-2 (level 2 child)
  • services (parent)
  • item 1 (level 1 child)
    • item 1-1 (level 2 child)
    • item 1-2 (level 2 child)
  • item 2 (level 1 child)
    • item 2-1 (level 2 child)
    • item 2-2 (level 2 child)

I want to count only "level 1 childs" inside start_lvl() for each parent item individually.

In above example, output should be for about (1) and services (2) because "about" has only 1 child for level 1, and services has 2 childs for level 1

Please somebody help, I have searched a lot and tried almost all methods available on Stack Exchange, Overflow etc...

Source Link
Adeel
  • 11
  • 4

Count Level 1 Childs for Custom Nav Walker Wordpress

I have three levels of my menu created in custom walker class. Output is like below:

home (parent) about (parent) item 1 (level 1 child) item 1-1 (level 2 child) item 1-2 (level 2 child) services (parent) item 1 (level 1 child) item 1-1 (level 2 child) item 1-2 (level 2 child) item 2 (level 1 child) item 2-1 (level 2 child) item 2-2 (level 2 child)

I want to count only "level 1 childs" inside start_lvl()

In above example, output should be for about (1) and services (2) because "about" has only 1 child for level 1, and services has 2 childs for level 1

Please somebody help, I have searched a lot and tried almost all methods available on Stack Exchange, Overflow etc...