string concatenation will concatenate any two things that can be strings. "a" . "b", completely valid, because they’re both strings. "a" . 3, also valid because an integer can be implicitly cast as a string. "a". babbit(), might be valid, depending on the return of babbit().
concatenation is an operator, like + or - ; you cant do “a” + “b” (well you can, but it’s a 0 and will belch warnings at you that you tried to use a non-numeric value in a math operation).
Like + requires numeric-able operands, . requires string-able operands.
echo "a" . 3 . max(1,2) ."b";
is a perfectly valid piece of code. Little odd on the eyes, but valid.
Still wrong. You need to follow and count how many single quotes and double quotes you have. I know you said you fixed it so that’s good. But this code you now have is being translated to literal $list->ID instead of the value of $list->ID. When you use single quotes, you have to escape the single quotes if you want to use any variable of any sort or it’ll give you the exact thing you gave it.
You were attempting to do that, but incorrectly escaped it which was what I was pointing at.
EDIT: I had typed this in a draft and didn’t see the fixes until now. Your fix is right.
On your original issue, if you avoid concatenation altogether, by putting the php variable(s) inside of an overall double-quoted string, you can simplify the syntax by eliminating the extra quotes and extra dots, reducing the chance for mistakes.