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

Use Sprig/Twig for Templating #9

Merged
merged 62 commits into from
Dec 7, 2018
Merged

Use Sprig/Twig for Templating #9

merged 62 commits into from
Dec 7, 2018

Conversation

kingkool68
Copy link
Owner

@kingkool68 kingkool68 commented Nov 6, 2018

This pull request switches all HTML rendering to Twig via the Sprig for WordPress. Now there is a clearer separation between PHP and HTML.

Other Fixes

  • Took the time to add docblocks and clean up some unused code
  • Instead of calling instances of classes I switched to calling static methods instead
  • Post galleries work again and are snappy thanks to some smart JavaScript

Todo

  • Turn rsvp.php into a class
  • Cleanup class-daddio-instagram-locations.php
  • Cleanup class-daddio-instagram.php
  • Cleanup class-daddio-media.php (Handle helper functions)
  • Cleanup class-daddio-on-this-day.php
  • Cleanup class-daddio-post-galleries.php (Also figure out why it doesn't work anymore)
  • Cleanup actions for gallery. Instead just call the methods directly and reduce number of custom actions.
  • Daddio_Menus::action_daddio_footer() needs Twig
  • Refactor action_daddio_footer
  • Refactor action_daddio_before_content
  • Clean up 404-date-archive.php
  • Clean up 404-age-archive.php
  • Clean up archives.php
  • Clean up content-on-this-day-switch-date-form.php

…their own methods

Now this can be reused for other scripts and styles registered in other classes. Yay for better modularizing.
We need some dynamic values so this is the only way we can pass dynamic values into a Twig template and still have it appear as part of base.twig.
Also convert one render method to use Sprig/Twig.
…llery class.

Also renamed `Daddio_Scripts_Styles` class to match the file name.
Just use static methods instead.
…te parts.

Less abstract, just as effective, simpler.
We can just output what we need directly.
Prevents showing a count with no heading. Without this the homepage looks weird.
Also need to register the on-this-day script on init so it can be called on the wp_enqueue_scripts action.
`Daddio_On_This_Day::get_switch_date_form()` does the trick.
@kingkool68 kingkool68 changed the title [WIP] Use Sprig/Twig for Templating Use Sprig/Twig for Templating Dec 7, 2018
@kingkool68 kingkool68 merged commit f46912e into master Dec 7, 2018
@kingkool68 kingkool68 deleted the use-twig-for-templates branch December 7, 2018 04:00
@kingkool68 kingkool68 restored the use-twig-for-templates branch December 7, 2018 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant