Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the Template API #218

Closed
4 of 5 tasks
shazahm1 opened this issue Jul 18, 2013 · 7 comments
Closed
4 of 5 tasks

Improve the Template API #218

shazahm1 opened this issue Jul 18, 2013 · 7 comments
Assignees
Milestone

Comments

@shazahm1
Copy link
Member

The firth gen API is great for me, however, it makes it far more difficult for users who just want to tweak their templates a little. So let improve that a little by:

  • Add an option to disable the enqueueing of the skeleton CSS file. Ref Add option to disable styles. #216.
  • Develop method to disable the enqueuing of template specific CSS files.
  • Create process to easily allow user to override a template's CSS file with their own tweaked version.
  • Create a method that allow a user to easily override a template file.
  • Create a template loading hierarchy.
@shazahm1
Copy link
Member Author

Disabling CSS Detail

  • Add a new settings section under the Advanced tab for CSS.
  • Include a directions header.
  • Add option to disable core CSS.
  • Add option to disable Chosen CSS.

NOTES:

The Chosen and qTip styles should not be enqueued by default. The template's should enqueue them as needed. I'm stuck with loading the Chosen CSS for now, but I should update all templates that use it to enqueue the CSS. As for the CSS for qTip, leave it registered, but their is no reason to enqueue it.

  • Do no enqueue the CSS for qTip

@shazahm1
Copy link
Member Author

Overriding Template CSS Detail

User would create a folder named connections_templates in their parent or child theme; within that folder they would create a folder named with the template's slug. They could then copy the the template's CSS file into this folder which will override the template core CSS file. This should make it upgrade safe when upgrading both the templates and core.

  • This should be hierarchal. First look in the child theme, then parent theme, next the connections_templates folder and lastly in the template's folder.
  • When in each folder, first check for a minified version if WP_DEBUG is enabled and then check for the un-minified version. If WP_DEBUG is not enabled an no minified version is available, load the un-minified version.

@shazahm1
Copy link
Member Author

Overriding Template Layout Files

User would create a folder named connections_templates in their parent or child theme; within that folder they would create a folder named with the template's slug. They could then copy the the template's files into this folder which will override the template core files. This should make it upgrade safe when upgrading both the templates and core.

  • This should be hierarchal. First look in the child theme, then parent theme, next the connections_templates folder and lastly in the template's folder.

@shazahm1
Copy link
Member Author

Loading template files based on context.

Currently using the template API a list result card and a single entry card can be registered for use. Using this method required that the user know just a little more than just basic PHP. This should be changed to load based on if the file exists or not. This will allow for the user to easily override a template file in an upgrade safe manner and add support for other views if the template does not come with one.

  • Create template loading based on context.
  • If file exists, it should override the template parts registered via the API. This will provide backward compatibility for all the templates out there.

Template should load in the following order:

  • card-category-category_slug.php
  • card-category.php
  • card-country-country_slug.php
  • card-country.php
  • card-region-region_slug.php
  • card-region.php
  • card-postal-postal_slug.php
  • card-postal.php
  • card-locality-locality_slug.php
  • card-locality.php
  • card-locality-locality_slug.php
  • card-organization-organization_slug.php
  • card-organization.php
  • card-deparment-deparment_slug.php
  • card-deparment.php
  • card-single-name_slug.php
  • card-single.php
  • card.php

NOTE: This really isn't a true hierarchy, the template that will be loaded will be based on context of what the requested results are. Only if the template file for that context is not available will it fall back to the card.php template file.

@ghost ghost assigned shazahm1 Jul 18, 2013
@shazahm1
Copy link
Member Author

Important

Note to self: Keep qT in mind when making these changes because templates created with qT will not have actual files, but if the files exist, they should override what was added when making the qT.

shazahm1 added a commit that referenced this issue Aug 16, 2013
Do not enqueue the qTip CSS in core, just register it. Enqueue the CSS
in the template. gh-218
@shazahm1
Copy link
Member Author

@shazahm1
Copy link
Member Author

This class can very likely be modded for my use.

ref:
http://pippinsplugins.com/template-file-loaders-plugins/

@shazahm1 shazahm1 mentioned this issue Feb 12, 2014
shazahm1 added a commit that referenced this issue Apr 16, 2014
This is to allow the use of template override files.

gh-218
shazahm1 added a commit that referenced this issue Apr 16, 2014
shazahm1 added a commit that referenced this issue Apr 16, 2014
Required for compatibility for the cnTemplate refactor.

gh-218
shazahm1 added a commit that referenced this issue Apr 16, 2014
Incorrectly using self to call a method.
Add missing phpDoc.

gh-218
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant