Sub-folders for static pages
-
761005
Hi – I need to redo my site in CMS. Most pages are static and are in sub-folders, eg juicing in \juice sub-folder, ionizing in \water sub-folder.
Once when I tried using php to have the same menu on every page, it could not handle sub-folders. All files had to be in root folder for the php menu to work on every page.
Can wordpress handle sub-folders? Or is it best to move all static pages into the one root folder, and use a prefix to distinguish all the static pages that belong to a specific section? e.g. all juicing pages begin with jcr- , all ionizing with ion-.
I need to be able to change one menu in the php and it will change on every page. I don’t want to change the menu individually on every static page.
For regular dynamic pages written in wordpress, I guess they’re all in root folder?
thanks, Val
-
Val,
For regular dynamic pages written in wordpress, I guess they’re all in root folder?
There’s a bit of a shift in the way you may think of pages and posts in WordPress relative to mostly static pages on a site.
In WordPress all pages and posts are obviously stored in a database.
Can wordpress handle sub-folders?
There are no actual folders to house different pages; only a different hierarchy within the database, which is controlled through the WP admin panel.
If you wish to have pages that appear to be in sub-folders or sections of a site, you can make the sub-pages have a parent page.
For example, if you have a page called ‘ABC Gizmo’ that is a sub-page of your ‘Sprouters’ section, select ‘Sprouters’ as the parent page of ‘ABC Gizmo,’ when you’re creating the ‘ABC Gizmo’ page. Then your URL (if using permalinks) might be something like:
https://mysite.com/sprouters/abc-gizmo
Dynamic Navigation
Once when I tried using php to have the same menu on every page, it could not handle sub-folders. All files had to be in root folder for the php menu to work on every page.
The menu navigation that you add can be dynamically called into the template in a few different ways. You can use straight PHP includes like:
<?php include(TEMPLATEPATH . '/single2.php'); ?>
, or more likely you can incorporate your navigation into the header (header.php), footer (footer.php), or sidebar (sidebar.php) and call them into WordPress built in functions like:
- the get_header() template tag
- the get_sidebar() template tag
- the get_footer() template tag
When you’re creating your navigation links, you’ll likely be using either a built-in WP function like wp_list_pages (which will create links that will work no matter how deep, or nested, the page is), or you can link to pages, posts, or categories individually using one of several methods listed here:
https://codex.www.ads-software.com/Linking_Posts_Pages_and_Categories
More info at:
https://codex.www.ads-software.com/Theme_Development#Basic_TemplatesPersonally, I often put my navigation in the header.php or sidebar.php
files, although I’ve used almost every method available.Locating your WordPress files
Personally, I prefer to have all of my WP files in a subdirectory on my hosting accounts. So, if public_html is my root web folder, I’d create a folder called ‘wordpress’ or ‘cms’ or the like and locate all my WordPress files there.Then, when I’m ready to ‘go live’ with the site, I’ll change the WordPress and Blog URI’s in the Admin control panel and follow the instructions here for ‘moving your blog’:
https://codex.www.ads-software.com/Moving_WordPress
Hope this helps.
Hi – thank you, this makes it really clear! My last question (famous last words ?? is –
(1) is it better to have all pages in wordpress, and have wp generate them all on the fly?
(a) Advantage – all data is included in wp search + in RSS feeds
(b) Disadvantage – page takes longer to load? AND Often the page structure isn’t loaded so I see only ugly black variable width text on a white background and no position:absolute recognized (and no working links?).
(2) Is is better to leave complicated product pages with comparison charts that occasionally get updated OUT of wp and upload them separately to site (with nav links to them in wordpress footer.php).
(a) Advantage – guarantee that the page will load quickly and look the way you want it? Although I notice with xhtml + css, there’s no guarantee any more that structure will load even outside of wp – especially if someone’s using an old browser with my doctype of choice, viz:
!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
thanks! – Val
Hi – (1) for my comparison charts, if I do them in wordpress, is it better to do them in an html table in a text editor, then upload this into the code section of wp? Or is better to look for a wp plugin that does charts in css tables? I specially want mobiles to read the site and I read that the mobile plugin for wp prefers css tables.
(2) Is there a way that I can name pages myself in wordpress? I notice in posts WP picks up the page name from the header. So I guess it does that for pages too, but I need some way to identify, say, all juicing pages, e.g. prefix each with jcr-, so I can apply the juicing navigation menu to them, and a way to identify all blending pages, e.g. prefix each with bl-, so I can apply the blending navigation menu to them.
thanks, Val
Hi Val,
Will do my best here:
(1) is it better to have all pages in wordpress, and have wp generate them all on the fly?
(a) Advantage – all data is included in wp search + in RSS feeds
(b) Disadvantage – page takes longer to load? AND Often the page structure isn’t loaded so I see only ugly black variable width text on a white background and no position:absolute recognized (and no working links?).
This is really up to you as the site developer or owner. Personally, I’d prefer to have as much of my content under one management system for simplicity’s sake. So I’d put it all into WordPress most likely. Exceptions may be if I have a shopping cart that doesn’t integrate easily with WordPress, or if I require some other functionality that’s not provided through WP or a trusty plug-in.
As far as the pages taking longer to load, they really shouldn’t be noticeably longer if you’re on a decent server and your WordPress theme and plugins are put together well.
I’ve seen a few sites that had lots of errors or spam links that were slowed in the browser. I run a lot of WordPress sites and don’t notice any problems.
(2) Is is better to leave complicated product pages with comparison charts that occasionally get updated OUT of wp and upload them separately to site (with nav links to them in wordpress footer.php).
Again, this is really up to what you’re trying to accomplish. Personally, if it’s a simple product comparison table, I would probably work on the table outside of WP and paste the code into the HTML view.
Then I’d style it with CSS.
(a) Advantage – guarantee that the page will load quickly and look the way you want it? Although I notice with xhtml + css, there’s no guarantee any more that structure will load even outside of wp – especially if someone’s using an old browser with my doctype of choice, viz:
!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
Again, your ‘advantage’ shouldn’t be too much of an issue. CSS styles work just as well inside WP as they would outside of it. You should be able to make your tables look exactly like you’d want wherever they’re located.
Although I notice with xhtml + css, there’s no guarantee any more that structure will load even outside of wp – especially if someone’s using an old browser with my doctype of choice, viz:
If you’re having issues using the strict doctype, try starting with Transitional.
If your table is coded correctly, you shouldn’t have trouble rendering it in any of the major modern browsers.
Some CSS selectors and tricks may have uneven support in older IE versions.
Hi – (1) for my comparison charts, if I do them in wordpress, is it better to do them in an html table in a text editor, then upload this into the code section of wp? Or is better to look for a wp plugin that does charts in css tables? I specially want mobiles to read the site and I read that the mobile plugin for wp prefers css tables.
Val, if I’m using tables for what (I believe) they should be used for, presenting tabular data, then I’d use regular tables for your comparison charts.
Trying to recreate a table in CSS can be frustrating, even though it’s not impossible. There are also some usability reasons why it may be best to keep tabular data in a table, such as people using screen readers.
Because looking at table code is an easy way to make your eyes try to rebel and choke you, it may be easier to work with tables in a WYSIWYG editor, or even in a text editor & checked in browser, and then paste the generated code into WordPress.
(2) Is there a way that I can name pages myself in wordpress? I notice in posts WP picks up the page name from the header. So I guess it does that for pages too, but I need some way to identify, say, all juicing pages, e.g. prefix each with jcr-, so I can apply the juicing navigation menu to them, and a way to identify all blending pages, e.g. prefix each with bl-, so I can apply the blending navigation menu to them.
I think I’m confused by your question. Seem to be referring to two types of names:
One is the actual name of the post/page. If you wrote a post and called it ‘Juicers’ in the title of the Write panel, the name of the page would be ‘Juicers’.
The second is the filename, or how it looks in the URL of the browser. This depends on your permalink scheme. If you’re not using permalinks, you’re likely to see the post ID and a URL that looks like mysite.com/?page_id=4. With permalinks, it could look like mysite.com/juicer – in the latter case the ‘juicer’ is automatically generated as the permalink based on the name. You can change this, though.
If you’re trying to keep track of pages in different sections of the site, why not give the sub-pages an appropriate parent page.
For example, if you have a Juicers section and you needed to create a page on Juicer FAQs, you could choose Juicers as the parent page when you’re writing the Juicer FAQ in the Admin panel.
Then, when you look at the page list, you’ll see them appear as an indented list/outline.
so I can apply the juicing navigation menu to them
If they’re sub pages of a Parent page, you should be able to list them using template tags without giving them a complex prefix or different naming scheme. I’d give the little suckers parents. ??
- The topic ‘Sub-folders for static pages’ is closed to new replies.