View Full Version : Portfolio page faulty display
mr108
07-28-2016, 01:26 AM
Hello,
I'm continuing testing and trouble shooting a new update of a WordPress theme. The old version of the theme is here (sample page):
http://terrybraunstein.com/portfolio/
and it displays the Portfolio page in a proper GRID design as it should be.
and the new version is here:
http://sg.terrybraunstein.com/portfolio/
and this displays the Portfolio page as if it would be a Blog
I checked carefully the proper settings and selected its correct Template (Portfolio)
Portfolio Page grid shows only when you open one of the posts, e.g. this one:
http://sg.terrybraunstein.com/portfolio/who-is-she-2013-2014/ and close it clicking on the X in the upper right. Clicking again on Portfolio in the Menu shows the Blog design again.
I installed a WordPress plug in, Query Monitor, and there is a PHP error showing up when opening this page :
http://sg.terrybraunstein.com/portfolio/who-is-she-2013-2014/
but I don't know anything about PHP so that error message does not say anything to me. Here is the screen-shot of the error message:
5916
What could be the reason that the Portfolio page is not displaying properly in the new version?
jscheuer1
07-28-2016, 03:14 AM
PHP errors can be difficult to deal with, yet they often are quite literal. Too much so sometimes.
It means what it says. The PHP interpreter found an undefined variable by the name of url. Because of this, it assumed it was a string - 'url'. Not a big help. But that pretty much assures that url at that point is expected to be passed or that it was meant to be a string. Since I'm not seeing the code, it could be a string that as a property of some object or array is meant to signify something. That's usually what that sort of error means. But it could be meant to be a literal string (unlikely).
Give this some time to sink in. Then give me any further thoughts.
Also, if I could see the PHP code that's producing this error, I might be able to contribute more.
It's also possible that this is just a non-fatal error in the PHP code and that the actual problem lies elsewhere.
mr108
07-28-2016, 03:46 AM
I'm attaching a zip file with all the php files mentioned in the error message:
Notice Use of undefined constant url - assumed 'url' 1 wp-content/themes/yin_and_yang/includes/portfolio.php:67 load_template('~/wp-content/themes/yin_and_yang/includes/portfolio.php')
wp-includes/template.php:531
locate_template()
wp-includes/general-template.php:167
get_template_part('includes/portfolio')
wp-content/themes/yin_and_yang/single-portfolio.php:326 Core
5917
jscheuer1
07-28-2016, 05:29 AM
Got them. It's late here. And as I think I indicated, not sure I will be able to solve this from that - just that it will give me a better chance. I'll have a look tomorrow, or over the weekend.
Beverleyh
07-28-2016, 10:58 AM
You say you have recently upgraded the Yin & Yang theme but have you also upgraded the version of Wordpress it's running on? If you've only updated the theme, maybe that's the problem? You might need to upgrade the core Wordpress files too. Same for any other plugins you're using. It might be worth disabling all addons and then gradually add back and test between each additions to see if you can narrow down any conflicts.
Another thought: the Yin & Yang theme is a premium Wordpress download so if your help period from the developer has expired since your time of purchase, it might be a good idea to extend the support package you have with them as their existing customer. Changes and modifications by the original developer (who will be more of an expert in Wordpress than we are) can be built in to the core and should be compatible with future updates (both in Wordpress core files and in the theme) but small ad-hoc updates and fixes by outside coders in the here-and-now will be more general and may need further adaptations as your core changes in the future. Just something to bear in mind.
mr108
07-28-2016, 11:16 AM
You say you have recently upgraded the Yin & Yang theme but have you also upgraded the version of Wordpress it's running on?
Yes, I did.
Same for any other plugins you're using.
All updated as well.
It might be worth disabling all addons and then gradually add back and test between each additions to see if you can narrow down any conflicts.
I did that as a part of trouble shooting, even when all plugins are disabled the portfolio pae does not display properly.
Another thought: the Yin & Yang theme is a premium Wordpress download so if your help period from the developer has expired since your time of purchase, it might be a good idea to extend the support package you have with them as their existing customer.
I may suggest this to my friend (the owner of the site and the theme) whom I'm helping now if I don't succeed...
Changes and modifications by the original developer (who will be more of an expert in Wordpress than we are) can be built in to the core and should be compatible with future updates (both in Wordpress core files and in the theme)
The old theme is 5 years old, so big changes were needed to be made to make the theme up to date with the latest standards, which means that some things had to be rebuilt from ground up, so a simple update of the theme does not work.
mr108
07-28-2016, 11:21 AM
Somehow this line in the portfolio.php file maybe giving some clue?
In the error message it says:
Notice Use of undefined constant url - assumed 'url' 1 wp-content/themes/yin_and_yang/includes/portfolio.php:67
and the line 67 is:
<img class="preview-img" src="<?php echo esc_url($image[url]); ?>" alt="<?php the_title_attribute(); ?>" />
styxlawyer
07-28-2016, 03:43 PM
.
.
and the line 67 is:
<img class="preview-img" src="<?php echo esc_url($image[url]); ?>" alt="<?php the_title_attribute(); ?>" />
In PHP all variables begin with the '$' sign so "url" in that line isn't seen as a variable by PHP. I suspect it should be:
<img class="preview-img" src="<?php echo esc_url($image[$url]); ?>" alt="<?php the_title_attribute(); ?>" />
jscheuer1
07-28-2016, 04:19 PM
Actually, in PHP, the square bracket notation is most likely to contain a quote delimited string representing a key in an array. That's most likely the case here, although it's slightly possible the $ was intended*. Also, when error reporting is off and PHP is in one of its less strict modes, a string is assumed and there's no problem. In more strict environments, it can be a fatal error, either in PHP itself, or because the resulting string includes the error message, which breaks the intended output.
Anyways, we can fix that, but there could also be other problems, in fact three, of the four files in the zip, three have this same loose syntax. Once I have them all located and fixed, I'll send you the repaired set of files. Keep the zip you already sent me as a backup just in case.
* more often found in loops, like a foreach loop. I don't see any obvious loop in the sections of code involved here. Also, if that is the case, usually it's a more generic term, like $key. Further, I think the original error message stated it assumed 'url', not $url, though of course that isn't necessarily definitive. That said, one almost has to assume this code worked in its development environment. That would almost assure its missing quotes, not missing a $, as no level of PHP will automatically supply a missing $, though loose PHP settings will allow for missing quotes with no error.
mr108
07-28-2016, 04:22 PM
In PHP all variables begin with the '$' sign so "url" in that line isn't seen as a variable by PHP. I suspect it should be:
<img class="preview-img" src="<?php echo esc_url($image[$url]); ?>" alt="<?php the_title_attribute(); ?>" />
I tried this but it does not work, no change. Thanks anyway.
jscheuer1
07-28-2016, 04:33 PM
OK, all done. Turns out there were only a total of three such syntax errors in only two out of the four files. I'm attaching the zip:
5918
I included a folder in the archive that has the four fixed files in it. This is in part because it's easier for me to make zips like this one which include a root folder, and because it should make it easier for you to keep the fixed files separate from the old versions. Just make sure when unzipping you look inside the folder (same name as the zip) for the files.
See also my previous post if you missed it:
http://www.dynamicdrive.com/forums/showthread.php?80298-Portfolio-page-faulty-display&p=318631#post318631
And I would add that these files may be cached on the server (different than the browser cache, which of course should also be cleared, pages refreshed), so results of changes might not appear immediately.
mr108
07-29-2016, 12:29 AM
And I would add that these files may be cached on the server (different than the browser cache, which of course should also be cleared, pages refreshed)
I cleared the server cache and the browser cache (both FF and Chrome) and it's still the same blog display... :(
jscheuer1
07-29-2016, 02:36 AM
Yes, but has the PHP error disappeared? I mean, we can still work on this further. But I think we need to eliminate the PHP error as a possible part of the problem. Has at least that much been fixed? I think you're saying it has been (because you thanked my post), and that there's still a problem with the display. But, as I say, I want to be sure that's where we're at, is it?
mr108
07-29-2016, 02:56 AM
Yes, the PHP error disappeared - very good!
*and I also tested if deleting the Portfolio page and recreating it will make any difference, but it did not, same display...
jscheuer1
07-29-2016, 05:25 AM
OK, good. I'll have a closer look soon.
jscheuer1
07-29-2016, 04:14 PM
Wow, I've just been looking at this and that's pretty messed up. This might be is something support for this template could better address than we could here. I see only one clue right off. Notice the menu bar we were working on before? Look at the highlight. It thinks it's on the events page, which of course is set to the blog format. I have no idea why the bar highlight thinks its on the events page, but I'm fairly sure it's the same reason the template itself thinks it should be displaying in blog format. I'll see if there are any other clues in the files you already sent, or in the pages themselves. But I also want you to see if you can figure out why it seems to think it's on the events page.
mr108
07-30-2016, 02:53 AM
Wow, I've just been looking at this and that's pretty messed up. This might be is something support for this template could better address than we could here.
Probably...
I see only one clue right off. Notice the menu bar we were working on before? Look at the highlight. It thinks it's on the events page, which of course is set to the blog format. I have no idea why the bar highlight thinks its on the events page, but I'm fairly sure it's the same reason the template itself thinks it should be displaying in blog format.
Yes, that's definitely wrong. I'm comparing to a properly functioning theme here: http://www.meloccomoore.com.au/ and the bar highlights are following and staying in proper places there.
But I checked few things now:
1. removed the Events from the Menu: the bar highlight stays above Site Entrance (!) instead which is NOT a blog page
2. set the Events page to Draft: same as above
3. disabled all the plugins: no change
4. checked the same behaviour on another test site that I created from scratch with the same theme version: http://yy3.atwebpages.com/ ; there is no blog page here. The bar highlight is properly on Sample Page but when you click on Portfolio it is on Welcome page.
The whole thing is weird.
But that Bar is coded in java script, right? Not css.
jscheuer1
07-30-2016, 04:31 AM
How about going back to how it was when I last looked at it with the only change being temporarily setting the events page to be GRID - just to see what happens? Won't fix anything, but may give us more insight.
mr108
07-30-2016, 07:58 AM
Now Events page is set with Portfolio template (GRID) - no change.
mr108
07-30-2016, 04:01 PM
I found it! :)
I was observing how the URLs were changing or actually NOT changing when you select a particular Portfolio item in other websites with the same updated theme - the URLs remained the same (unless you right-click and open that item in a new tab, then the URL is for that particular item). Also all the other websites that I came across (this one is one of them: http://www.meloccomoore.com.au/) have their Portfolio page set as the Home page, as the static Front page - this is the most important!
Once I've set the Static page to be the Portfolio page it is displaying properly in a grid pattern AND the highlight on the bar above the menu is also working properly.
Again if you right-click and open a Portfolio item in a new tab, then the displayed URL will be for that particular item AND the bar highlight will show above the Events.
So the outcome is good and not so good since my friend (the owner of the website) wanted to have that Site Entry page with the main URL as the Front page like in the old version:
http://terrybraunstein.com/
I reviewed the documentation of the theme and it says:
"Once you have made your homepage, navigate to the Settings » Reading tab, where you will find an option called "Front page displays". Select the static page sub-option and choose the page you just created as your front page. You can also have any other page as your homepage, by simply selecting it here, and saving the changes you made.
Your homepage is now created and can be viewed by visiting the page you just published."
but what I highlighted in red does not seem to be possible - maybe its a bug?
Anyway I'll see what we can do with this now...
John, thanks a lot for all your help, attention and focus! :)
Marek
jscheuer1
07-30-2016, 06:24 PM
Does seem buggy. But it might just be a poorly documented feature, something that could be done if it was explained more clearly. That leads me back to what I was going to do anyway at some point - looking at the PHP files. That's a bit more of a job for this part of it though. Something I could also use would be the comparable PHP files from the old theme. I'm thinking that if I'm lucky and good, I might be able to see what allowed the old theme to be more flexible, and/or what the new theme is expecting that it isn't currently getting to produce the result you want.
mr108
07-31-2016, 11:50 PM
That leads me back to what I was going to do anyway at some point - looking at the PHP files. ...
I've sent you a PM, please check.
Marek
mr108
08-01-2016, 11:50 AM
Does seem buggy. But it might just be a poorly documented feature, something that could be done if it was explained more clearly.
I submitted it as a bug report to the developer, but mentioned that it might be that he missed to explain it clearly that the Portfolio page has to be set as the static Front page.
In any case, if it's not a bug or if he will not fix it for a while I prepared a workaround fix:
I installed a separate WP with the theme in a folder called 'portfolio'. Portfolio page in that installation can be set to a static Front page. I added a Menu that points to the other pages in the original main site. When everything will be ready the http://terrybraunstein.com/portfolio/ will pick up the static Front page from the extra installation. I'll do that shift when all the images will get reselected in the new version of the theme (that's another incompatibility that resulted in updating the theme).
jscheuer1
08-01-2016, 04:43 PM
My thinking is perhaps it's possible to do it without juggling things around and/or perhaps using two copies of the theme as I think you are saying. Like maybe it can just work the way you wanted/expected it too, but that the way to do that wasn't clearly explained. But, as I say it might just be a bug, or perhaps the developer even consciously dropped the feature, figuring it wasn't being used enough to justify keeping it. Then again it might even be clearly explained (either its use, or the fact that it was dropped), but we've simply missed that so far. There are always those possibilities in a case like this.
BTW, got the files. May take a bit to make any sense of them.
mr108
08-02-2016, 11:56 AM
...Like maybe it can just work the way you wanted/expected it too, but that the way to do that wasn't clearly explained...Then again it might even be clearly explained (either its use, or the fact that it was dropped), but we've simply missed that so far.
The documentation is in the 'documentation' folder in the new version of the theme. I'm very sure I did not miss anything.
Another idea that I've got is to use redirection, perhaps in the .htaccess file?
Redirect from
1. http://sg.terrybraunstein.com/ to http://sg.terrybraunstein.com/site_entrance
and from
2. http://sg.terrybraunstein.com/portfolio/ to http://sg.terrybraunstein.com/ (which will show the portfolio page properly)
the only problem is that the second step will redirect again to http://sg.terrybraunstein.com/site_entrance
so is there any way to skip the second redirect to http://sg.terrybraunstein.com/site_entrance if it's coming from http://sg.terrybraunstein.com/portfolio/ ?
some kind of conditional redirection?
mr108
08-03-2016, 02:20 AM
Finally! I got it working properly without redirecting and without using the second installation of the theme. :)
I was playing with the redirecting WP plugin that would redirect pages as I mentioned above. Then I deleted the redirections but for some reason the http://sg.terrybraunstein.com/portfolio/ kept redirecting to http://sg.terrybraunstein.com/ so I renamed the link to http://sg.terrybraunstein.com/portfolio1/ and now suddenly Portfolio page started to show in its proper grid display. When using the old link http://sg.terrybraunstein.com/portfolio/ it still displays as a blog.
It's a mystery but it works.
jscheuer1
08-03-2016, 10:31 PM
Well, I was going to say that when you first mentioned a redirect that I thought you might be on a right track. I didn't though because I figured you would pursue it anyway, and though I know the general principles and where to look it up, I'm not all that proficient at it. I can only add at this point that what you've found makes an odd sort of sense in that I believe redirects are already a part of a theme of this nature, and might have already been at work frustrating our efforts. I would guess that you've somehow short circuited that by what you've done. And of course, in a case like this, if it works, I'm all for it.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.