A
A
AnatoliyKarpov2021-04-16 14:24:16
PHP
AnatoliyKarpov, 2021-04-16 14:24:16

How to make ul have different classes?

How to make ul have different classes, there is such a code that helps to change the class from the standard one, and here is the article itself where this code was taken

class True_Walker_Nav_Menu extends Walker_Nav_Menu {
  /*
   * Позволяет перезаписать <ul class="sub-menu">
   */
  // для WordPress 5.3+
  function start_lvl( &$output, $depth = 0, $args = NULL ) {
    /*
     * $depth – уровень вложенности, например 2,3 и т д
     */ 
      $output .= '<ul class="menu_sublist">';
  }

}

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Arman, 2018-07-12
@avatar22007

$i = count($url_arts);
here < or <= , but not =
According to the code, you assign the result of count($url_arts) to the $i variable, which gives the same result to the condition. It turns out that if the number is 0, then it will be false, if more than zero - true, and no number of iterations will change this situation, which is what you get an infinite loop

N
Nurlan, 2018-07-12
@daager

Endless cycle. You don't have a condition under which the loop will terminate.

B
Basitkhan Mansurov, 2018-07-12
@Basitkhan

Your cycle is wrong

for ($i=0; $i<=count($url_arts); $i++){
      $replace = str_replace($urls[0]->url_art_wp,$urls[0]->url,$url_arts[$i]->article);
}
dd($replace);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question