Drupal Theming Homepage - drupal

I'm trying to theme a Drupal site.
From what I was reading, if I have page--front.tpl.php, it should work for the homepage.
However, it doesn't seem to work for me.
From themer info, it is suggesting the file name to be page--node--6.tpl.php, which works, but I don't want to hardcode the id number.
Also $is_front is always coming back false.
For this node, I created a "Page" content type and select "bring it to front" and also set in site information for this node, which I alias to "Home" to be the default page.
Still not working. What am I missing?
Thank you,
Tee

If you have in page info
Default front page: node/6
then you could use page--front.tpl.php to theme the node as the front page, it must work.
Check you have the page--front.tpl.php in the correct place, in the
theme folder of the active theme.
Flush caches.

Related

Wordpress - /page/2 not working but /?paged=2 is

I have a WordPress site where my front page is showing the latest posts.
If I have my permalinks set as plain showing...
https://example.com/paged?=2
The page loads. However, If I change the permalinks to Post name, giving me...
https://example.com/page/2/
That results in a 404.
.htaccess seems to be set up correctly. The first page has posts and the links are being generated in the pagination controls. Using Post name as the permalink setting my posts are properly linked...
https://example.com/my-wordpress-post
But https://example.com/page/2/ does not work.
Any ideas? I really need to set the permalinks to Post name. Could it be a server issue?
First thing I would recommend is to confirm your .htaccess file is set up correctly to process permalinks. If you create a new page, can you access that page with his human-friendly permalink, for example? If not, you may need to fix your .htaccess file to handle those rewrites properly.
Otherwise, can you provide more context for this issue? Is it safe to assume you have your homepage set up with a list of paginated posts?
I figured this out. Instead of selecting Post Name, I select the Custom Structure radio button instead and manually added /%postname%/ and then clicked saved.
Then it worked. :)

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.

Renamed a page and changed the slug, now its gone

The title says it. I renamed a page in wordpress along with the permalink (the slug also changed) and now I can't find it on my site.
The menu updated along with my changes, but the page content isn't there when I click on it.
Here's the offending page
If anyone can tell me what I did wrong and particularly how to fix it, I'd really appreciate it.
Thanks in advance!
Try regenerating permalinks - editing permalink settings triggers that regeneration.
Also, if you have any kind of cache plugin running, purge it's data too.
This was a conflict with a portfolio feature in my theme (Bello by WeGraphics)... I renamed the permalink and it works fine now

Created a drupal theme, but now I can't login?

I'm new to drupal so please explain like I'm 5 years old.
I created a new theme for my drupal 7 setup. It consists of the info file and a page.tpl.php
Inside page.tlp.php I have literally placed hello, this is my theme. Nothing else.
I enabled the theme and disabled all the others, I made my theme the default.
So as expected the homepage returns my text. However, I had assumed that going to http://mysite.com/?q=user would show me some sort of default login. Apparently not? There is no login form and it only shows hello, this is my theme
I think my assumption that the login form would always be there was incorrect. Do I have to code this into my theme?
What would be a simple way to do this, if at all?
Thank you for your patience with my newbie question.
Try to copy things firstly from an existing theme, and modify only some parts of the template pages and see what happens. In page.tpl.php is rendered the whole page like header, footer, sidebar first where the login form is usually, sidebar second, etc.. that's why login form does not appear.
Change setting.php to previous if you have made any changes in it for this theme (and archive your present setting.php).
Delete your fold with this theme from fold THEMES.
http://mysite.com/?q=user (http://mysite.com/user)
Login.
Change theme to correct one.

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