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?
Related
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.
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.
I am trying to edit a WordPress site. When I try to edit the x.com/blog/ page nothing happens.
I am trying to find out which PHP files are related to set up the blog page, but I do not know how.
If I can find the right files I can edit those. So how can I edit the /blog page in Wordpress?
Open Admin Dashboard and edit page blog page and check which template is currently using for that page.Then go to "/wp-content/themes/[your-theme-name]/" and find that template.
https://developer.wordpress.org/themes/template-files-section/page-template-files/
Alternative you can check if x.com/blog/ is coming from archive page which is custom post type page. You can find it via go to "/wp-content/themes/[your-theme-name]/archive-blog.php"
https://codex.wordpress.org/Post_Type_Templates
Go to /wp-content/themes/[your-theme-name]/. All files which are responsible for rendering the output can be found there.
Most likely index.php, home.php, front-page.php or page.php are responsible. The exact responsibility depends on the structure of the used theme.
Simple drop a
echo "This file is used currently.";
into the top of those themes and check if this appears in the source code if you are reloading the page.
Also make sure that any caching plugins are temporarily deactivated.
The basics on how WordPress themes are made and which template part is called can be found here: https://codex.wordpress.org/Theme_Development
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.
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