Answer the question
In order to leave comments, you need to log in
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
$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
Endless cycle. You don't have a condition under which the loop will terminate.
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 questionAsk a Question
731 491 924 answers to any question