Jump to content

Using a single parent template for different child pages


Aleksey Popov
 Share

Recommended Posts

Hi! Is it possible to specify explicitly the parent section when creating a new child page with a single template?

The idea is to save the user from the possibility of mistakenly choosing a section, but not to create unnecessary identical templates

What I mean:

Let's say I've got 2 parent categories with names articles & news. Each of them utilized the same admin-template (category) with the category.php file. Also, I have 2 different templates for child pages (article & news).

Next, I need to add an article page to the articles category with the "create new" button in admin. At that moment, I must choose the category to place (because both categories use the same template). 

To runaround this (and create a page right into the exact category without the choosing step) I should create 2 templates for each category, and setup parent-children relations for each pair of templates, right?

But Is any way to use only the one category template and different children templates and at the same time, explicitly specify which section to use for child pages, thereby removing the process of selecting a child section?

 

articles (category.php)
	Article page 1 (page-article.php)
	Article page 2 (page-article.php)
	Article page 3 (page-article.php)
	+ Add a new article page here without category chooser

news (category.php)
	News page 1 (page-news.php)
	News page 2 (page-news.php)
	News page 3 (page-news.php)

 Update: found module  but I can't get it work.

 

Link to comment
Share on other sites

Hi Aleksey,

one way to add a new article page would be: Open any existing article for editing and save it with the option "Save + Add New". The new page will automatically get the same template like the sibling one getting saved.

But if there's no need for more than a few different categories, why not use an own template for each category? (And make benefit of the family settings).

Good luck
ottogal

 

 

 

Link to comment
Share on other sites

4 hours ago, ottogal said:

But if there's no need for more than a few different categories, why not use an own template for each category? (And make benefit of the family settings).

Hi ottogal
The main idea was to prevent mistakenly added pages into wrong categories by customers. And minify similar templates amount in general. But anyway I have not too many templates (less than 12) so I decided finally to add template pairs for each group to get better flexibility in further.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...