Timeline for Setting featured image with function, 1 part not working
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 30, 2013 at 20:53 | comment | added | tfrommen | Well, it's not the ordinary conditional structure, that's right. But in this very case - where you want to set the value of a variable by a function, under the circumstance that the function does return something (meaning: not null, false etc.) - then you can do it like illustrated in my answer. Your approach is definitley the intuitive one, and for most of the time anyone would do it like that. Here, it would mean each function is called twice, though. | |
Apr 30, 2013 at 20:27 | comment | added | Eckstein | I see. I've never structured my conditionals like that, but I guess it makes sense to not have to call it twice. I'll go ahead and change it. Thanks for the advice! | |
Apr 30, 2013 at 19:34 | comment | added | tfrommen |
Hey, nice you figured the last case out by yourself, however, you really should use the if -elseif construct like I did, otherwise you'd call each of the get_* functions twice, which is unnecessary. See my updated answer on this.
|
|
Apr 30, 2013 at 18:57 | history | answered | Eckstein | CC BY-SA 3.0 |