Reputation
247
Top tag
Next privilege 250 Rep.
View close votes
Badges
2 12
Impact
~15k people reached

  • 0 posts edited
  • 1 helpful flag
  • 4 votes cast
Dec
23
comment wp_nav_menu: check if the list item has children and add a class to anchor link
It should work, manually run the query in your db and check if you are getting result for the query. Use debug echo statement to print out query string and the count you get. This is the only way you can get it work.
Dec
23
comment wp_nav_menu: check if the list item has children and add a class to anchor link
@Sergey I doubt if you are using WordPress nav menu. Try removing AND post_type='nav_menu_item' from the query.
Dec
23
comment wp_nav_menu: check if the list item has children and add a class to anchor link
@Sergey it wont make difference. You can use it for any nav menu item. Can you give link to your page where you test it?
Dec
23
awarded  Editor
Dec
23
comment wp_nav_menu: check if the list item has children and add a class to anchor link
@KevinLangleyJr. Thanks for pointing out. I overlooked the question.
Dec
23
comment wp_nav_menu: check if the list item has children and add a class to anchor link
@Sergey Added code as per your request.
Dec
23
revised wp_nav_menu: check if the list item has children and add a class to anchor link
updated response by adding code snippet
Dec
23
answered wp_nav_menu: check if the list item has children and add a class to anchor link