Questions and ideas for the Page Attribute Display block
Permalink
In version 5.7, page types and page templates are separate entities, and I can definitely see how this increases flexibility. This allows you to setup defaults for how a page is displayed when using Composer driven pages - on a per page template basis. For example, a blog page type would look one way on a full page template and another way on a right sidebar template. You visually design the page by dragging the Page Attribute Display block onto the page and choosing an attribute or property.
Where this is not an advantage is control of the presentation. In 5.6, where page types and page templates were bound together, you had full control of where an attribute went, what class or id it had, and other styling/page formatting.
The Page Attribute Display block does allow for wrapping the attributes in various tags. This approach seems to add overly broad classes and unnecessary spans. When adding multiple page attributes per page and multiple page templates, it seems like a challenging situation to control styling.
Example:
Display property with formatting
div
Display property with formatting
none
Display property with formatting
H3 (Heading 3)
Display property with formatting
p (paragraph)
So I have an idea and a couple temporary solutions.
The idea is include the ability to add a class and/or id to a page attribute in the Page Attribute Display block (and remove the extra span tags). This way you could have page template specific classes for attributes (e.g. full-attribute_name, rsb-attribute_name, lsb-attribute_name) to control wherever they are used.
http://i.imgur.com/OQFTbQs.png
The temporary solutions are making custom templates for each attribute or making a page templates that behave like 5.6.
Example custom template
Example recreating 5.6 page template behavior
- create a new page in your theme folder - e.g. news_entry.php
- Dashboard > Pages & Themes > Themes > inspect your current theme
- you will see your news_entry as a new template and the option to Create page template
- click ok
- Dashboard > Pages & Themes > Page Types > Add Page Type
- when choosing the Page Type Name and Page Type Handle, use the same name and handle as the page template
Page Type Name:
News Entry
Page Type Handle:
news_entry
- Default Page Template:
News Entry
- Allowed Page Templates:
Selected Page Templates
- Page Templates:
News Entry
- choose your Composer option, frequently added, and publish method
Now when you Add Page and choose News Entry, it uses news_entry.php. You can wrap page type specific formatting and classes to get more control of the presentation.
Where this is not an advantage is control of the presentation. In 5.6, where page types and page templates were bound together, you had full control of where an attribute went, what class or id it had, and other styling/page formatting.
The Page Attribute Display block does allow for wrapping the attributes in various tags. This approach seems to add overly broad classes and unnecessary spans. When adding multiple page attributes per page and multiple page templates, it seems like a challenging situation to control styling.
Example:
Display property with formatting
div
<div class="ccm-block-page-attribute-display-wrapper"> <span class="ccm-block-page-attribute-display-title"></span>Home </div>
Display property with formatting
none
<div class="col-sm-12"> <span class="ccm-block-page-attribute-display-title"></span>Home </div>
Display property with formatting
H3 (Heading 3)
<div class="col-sm-12"> <h3 class="ccm-block-page-attribute-display-wrapper">10/08/14 08:00:am</h3> </div>
Display property with formatting
p (paragraph)
<div class="col-sm-12"> <p class="ccm-block-page-attribute-display-wrapper"><span class="ccm-block-page-attribute-display-title"></span>Home</p> </div>
So I have an idea and a couple temporary solutions.
The idea is include the ability to add a class and/or id to a page attribute in the Page Attribute Display block (and remove the extra span tags). This way you could have page template specific classes for attributes (e.g. full-attribute_name, rsb-attribute_name, lsb-attribute_name) to control wherever they are used.
http://i.imgur.com/OQFTbQs.png
The temporary solutions are making custom templates for each attribute or making a page templates that behave like 5.6.
Example custom template
Example recreating 5.6 page template behavior
- create a new page in your theme folder - e.g. news_entry.php
- Dashboard > Pages & Themes > Themes > inspect your current theme
- you will see your news_entry as a new template and the option to Create page template
- click ok
- Dashboard > Pages & Themes > Page Types > Add Page Type
- when choosing the Page Type Name and Page Type Handle, use the same name and handle as the page template
Page Type Name:
News Entry
Page Type Handle:
news_entry
- Default Page Template:
News Entry
- Allowed Page Templates:
Selected Page Templates
- Page Templates:
News Entry
- choose your Composer option, frequently added, and publish method
Now when you Add Page and choose News Entry, it uses news_entry.php. You can wrap page type specific formatting and classes to get more control of the presentation.