Wordpress hierarchy breaking (3.1.2) - wordpress

I've got a page in Wordpress that has a custom template assigned to it. It worked initially and without any notice it one day decided to default to index.php....
It won't go to its template_page.php or to page.php it always goes straight to index.php in my theme.
One extra odd thing i noticed is that when editing the page, it would not have the drop down underneath publish to select the custom template...never seen this before.
This is not the case for every other page i have on this build that uses a custom template. All other pages work just fine.
I have tried:
disabling all plugins / upgrading plugins.
changing and re-setting my permalinks.
deleting the page and re-creating it.
I've found that it will render the page occasionally but not always. I had solved it once and left it and it revert back to trying to use index.php to render the page after a few days.
I'm stumped, any thoughts?

Not sure why that would happen, but have you tried naming your custom template file page-yourpageslug.php or page-yourpageid.php. Wordpress should use that template by default without having to set it that way in the admin area.

Related

WooCommerce pages showing as blank

The cart, my-account and checkout pages are all blank when I try view them. All I get is the header and footer. All I have done so far is download WooCommerce, go through the settings and add theme support. My shop page wasn't working until I added theme support but now thats the only page that does. Also I've noticed that if I use WooCommerce shortcode in my php files I can get the pages. But the shortcode doesn't seem to be working in the backend. BTW I'm using my own custom theme incase thats relevant.
What can I do to fix this?
update:
This must be an issue with my theme as if I set one of the default ones to active all the WooCommerce pages show. But I don't know what my themes issue is yet.
update: I have noticed that the WooCommerce pages are allowing me to add templates to them, apart from the shop page which is working. Why is this happening?
There are few steps to do.
First turn on debug, by switching WP_DEBUG to true.
View source of page, and check if everything is being rendered, and also check console for JS error.
At last, for theme, if after switching to default theme, content shows up, there is a theme related issue.
Check for missing templates or template parts or structure within related with page from which content is missing and compare it with default themes templates and template parts.
See if there is some template part missing, or modified, like content.php or content-page.php, the_content() , etc.

Wordpress template assignment not working as expected

Whilst risking duplicating another post, I think this may be unique as other similar posts I've read haven't given me an answer that works for me. I have spent hours going through answers in other posts to no avail. I feel like what I've done should be working, but for some reason isn't.
I am new to Wordpress (but not development in general), and have set up a custom theme and page template (called index-gallery.php based on index.php and modified slightly to pull out my custom gallery posts). I have assigned that template using the page template dropdown on the right hand side of the page edit screen (using the remarked template name 'gallery page' that shows up fine in the list). So, you'd expect that to over-ride the standard hierarchy settings. However it isn't being applied and I'm seeing the index.php template being used. However, if I change the parent page of my 'gallery' page to be the home page it suddenly uses the 'index-gallery.php' template and the template works exactly as I'd expect. So I know it's not an issue with the template itself, as it works in that instance. I'm using 'what the file' plugin to see what templates are being used. I've tried re-assigning the slug in the page edit and re-setting permalinks etc, but that hasn't solved it.
Does anyone know what may be getting in the way of the template assignment when it's not parented to the home page? I don't really want it parented in that way.
This is all set up on my localhost running on xampp using Wordpress 4.9.7
You should rename your template files to something else (that doesn't begin with one of the standard WP template file names) - such as template-gallery.php
Oh, and you might find it better to base page templates on the page.php file anyway.

Changing a template on a blog page - WordPress 3.5.1

I am using an older version of WordPress 3.5.1.
I know how to use different templates on different pages but the problem is I cant figure out how to set a different template for my blog page. When I open the page Blog in the Edit Mode I see a blank page, contrary to my other pages which display their content. Is it possible that this page is a redirected from somewhere else and how can I figure it out? Also when I change the template from Page Attribute it does not take effect. On any other page it works but this one. How can I figure out how to change the page template?
There's no built in selectable templating system for blog posts. Its based on the actual template files and their hierarchical structure.
http://codex.wordpress.org/Template_Hierarchy
Its probably your index.php or single.php that is throwing an error. I would go into the wp-config.php and find the line that says define('WP_DEBUG', false); and change that to true. Then reload the page and see if it spits out an error. A basic loop is only a few lines of php, so I would guess there's an error somewhere on the page.
As for the pages not changing when you change the template, its possible there is conditional code or something in the template itself. Are you saying it only changes the look of the page on some pages but not others?

Fishpig Magento Extension: Homepage and sidebar widgets not working

When I add widgets to my "First Front Page Widget Area" nothing appears on my homepage.
I am using WordPress template Twenty Twelve. I created a "home" page and assigned it to be a "Front Page Template". I also customized the template to show the static page "home". I assigned the recent posts to show on homepage as a tests and nothing shows, just the page title (Home).
I tried changing my file Fishpig_Wordpress.xml (under app/etc/modules/) to Fishpig_Wordpress.xml.old, but this made WordPress inaccessible (404 error), so I changed the name back to Fishpig_Wordpress.xml.
Lastly, I tried updating the the extension to the latest version 3.0.3.8 (stable) and still the widgets are not showing.
Anybody knows what else I can do or what might be preventing my widgets from working?
Thank you!
Firstly, the app/etc/modules/Fishpig_Wordpress.xml file is the bootstrap file for this extension. This file instructs Magento where the code lives for this file. Deleting - or renaming - this file will not fix any issues but will disable the module (you may need a cache refresh for this change to be acted on).
With the latest version of the extension, widgets should work in the left or right columns of your Magento template. To ensure this, happens, enable the Twenty Twelve theme (which you have done) and ensure you are using the latest version of wordpress.xml. Check your custom theme's layout folder for wordpress.xml and rename it wordpress.xml.old, as this will force Magento to use the latest version of the file in base/default. After doing this, you will need to refresh your layout XML cache.
Next, ensure that you actually have some widgets enabled. To test this, enable a default widget like the Search widget or the Recent Posts.
The above is generic advice for people who can't get widgets to display. Your situation is slightly different as it sounds like widgets work for you, just not on your custom homepage. If this is correct, check that your custom WP page is using a template that has a sidebar column. You can do this by checking the HTML source. Alternatively, reply to this answer with your URL and I'll take a look.

wordpress page template not loading as front page

I have a page template set up as the front page but it's not loading for some reason. I've done this plenty of times in the past just fine.
I should be getting a body class of "portfolio-page-template" but rather I just get the regular "page-template".
I've tried resetting the permalinks, deleting/recreating the Portfolio page, changing back to the default theme and changing back, and still no dice.
Anybody know of a fix?
Need more info.
Did you save it as home.php did you override it in the settings? http://img.lajlev.dk/5a842c1e3dc470468c322af0fe79c004.png
Had a similar problem, and while it’s not an eloquent solution but when my working home page template started defaulting to my taxonomy.php template without reason, I tried all of the things you mention and then:
deleted the taxonomy template,
deleted the .htacces and refreshed the permalinks
selected and set the page-template-home.php again
noticed all was well
put my taxonomy template back and surprise - everything worked
very strange.
If this is not your issue, I can give you a few pointers on what to check for when setting up a custom page template, and what to check for if it fails.
Check the status of theme path or theme sittings

Resources