Tagged: 404site field set
- This topic has 9 replies, 2 voices, and was last updated 8 years, 9 months ago by smartology.
Author | Posts |
---|---|
February 17, 2016 at 2:31 am #3728 | |
smartology
Post count: 5
|
Hi, Do you have any suggestions to fix this? |
February 17, 2016 at 10:05 am #3729 | |
traversal
Post count: 207
|
Hi, just to clarify the approach, are you trying to use this code in a custom 404.php template? Does the call to the site field set just not produce any results, or does the code error? Thanks! |
February 17, 2016 at 8:30 pm #3731 | |
smartology
Post count: 5
|
Yes this is a custom 404 template. So i have the logo loading like so but if i take it out of the src, the page will not load. Cheers |
February 19, 2016 at 12:17 pm #3733 | |
traversal
Post count: 207
|
Hey, so I have found there’s a bug in the PHP unknown property methods which prevents something like this working when on a 404 page: $wf->header->logo->url; This assumes that your site field set is called “header”, and “logo” is the field name. The bug arises because of code that relies on the notion of a “current post”, which a 404 doesn’t have. (Will fix this). If I place “site” in between, the code then picks up that you’re talking about the site object, and then can find the set from that. So for me this works: $wf->site->header->logo->url; Your code implies you’re already doing that, so that’s weird. Another thing you could try is this: $wf->site->set(“header”)->logo->url; Let me know if any of this helps! |
February 19, 2016 at 9:24 pm #3734 | |
smartology
Post count: 5
|
Hi, I was wondering if it had something to do with “current post”. it is very odd as i can get the logo to work on some 404 pages but not others. I have tried set(“header”) but this stops the page from rendering, with error Thanks again. |
February 24, 2016 at 8:31 pm #3735 | |
smartology
Post count: 5
|
Do you have an update on this issue? |
February 24, 2016 at 9:30 pm #3736 | |
traversal
Post count: 207
|
Hey, is this a multisite environment? It seems like perhaps the site object isn’t defined either in some 404 pages, which I haven’t encountered before. What do you get with the following code? $wf->site->debug Another thing to try: $wf->site(1)->set(“header”) Thanks! |
February 24, 2016 at 10:22 pm #3737 | |
smartology
Post count: 5
|
Hi, No this is not a multisite. Debug stops the page from rendering. And site(1) stops the page from rendering. |
February 25, 2016 at 8:41 am #3738 | |
traversal
Post count: 207
|
Hey there, seems like even the $wf entry-point variable is not defined. Can you try adding the following at the top of your template file? global $wf; |
February 25, 2016 at 8:00 pm #3739 | |
smartology
Post count: 5
|
Cheers, that has fixed it. |
You must be logged in to reply to this topic.