Custom page types?

Post Reply
CarstenDenmark
Posts: 9
Joined: Sat Nov 06, 2021 2:53 pm

Custom page types?

Post by CarstenDenmark »

Hi everyone,
I have been trying to figure out how to setup different page types for my pages.
I looked at these posts, but they did not give me the result i wanted.
-----------------------------
viewtopic.php?t=1571

https://github.com/WonderCMS/wondercms/ ... e-template
-----------------------------

My wish is is to have different page structure so my thought was to have two, maybe 3 page types, so that i could change when i have the use of them.

However this has turned out to be difficult.

Is there any way this could be done?

As it is now the theme.php is not enough and coming from Concrete5 and Wordpress i am used to more flexibility.

NOTE, i am a graphic designer and not a hard core programmer.

/Carsten - Denmark
User avatar
wiz
Posts: 814
Joined: Sat Oct 30, 2010 12:23 am

Re: Custom page types?

Post by wiz »

Hi Carsten.

Do you want the end wanted result would be that for example?
- Home has different CSS
- Example has different CSS

The easiest way to achieve this is. For example if you want to style your page names "Home" completely differently.
1. In your theme folder, create home.php. In this example "home" must already exist as a page.
2. To make things easier, copy the content of the existing theme.php into home.php.
3. Then adjust home.php to look any way you want to now (add, remove css, anything you need to modify it to your liking).
4. For example, if you just put "test" inside the home.php, anytime your visitors visit example.com/home, they will see "test".


With this logic, you can create any file and customize it any way you want.
User avatar
NorfolkGreg
Posts: 171
Joined: Wed Sep 01, 2021 7:50 am

Re: Custom page types?

Post by NorfolkGreg »

Hi Wiz,

You seem to be saying, if there's a page called xxx and you then create a file xxx.php in the themes folder then rather than using theme.php as it's template Wcms will use xxx.php for that page.

Have I got that right?

If so, can further pages be made to use xxx.php as their template?
User avatar
wiz
Posts: 814
Joined: Sat Oct 30, 2010 12:23 am

Re: Custom page types?

Post by wiz »

Hey Greg, that's correct. The x.php would have to be populated by hand, otherwise it will be empty.
User avatar
NorfolkGreg
Posts: 171
Joined: Wed Sep 01, 2021 7:50 am

Re: Custom page types?

Post by NorfolkGreg »

But what about my second question?

The OP seemed not to be concerned about individual pages having a different theme but entire sections of a site. For example, if running a transport site, he might want all railway pages with one theme and all road another and all waterways a third theme.

I assume it would require some code built into the theme.php file that would ensure all sub-pages matched the theme of their parent and the top level of each branch would require the manual process you describe.
User avatar
wiz
Posts: 814
Joined: Sat Oct 30, 2010 12:23 am

Re: Custom page types?

Post by wiz »

So for example let's say the page navigation is as such:

Home
- Subpage Explore home
--- both of above would have the default theme.

And then user has another section of pages
Railyways
- Subpage Railways details.

If user wanted different theme for Railways and subpages. They would need to create railways.php and railway-details subpage and customise them to match the wanted design.


The same goes for specific sections, if you want to modify them there are two options:
- overwriting the name files.
- use if statements on the theme and put "if page XYZ" then echo this styles and section.
Post Reply