Closed rain2o closed 1 month ago
Here's another location where you could use the layout name as part of the template partial filename to simplify your implementation (the last suggestion in this issue).
Another place you could simplify the implementation of layout template partial
I've noticed several places where you have the following logic https://github.com/Myzwer/foothillschurch/blob/effc5bbf81497ae99f0561ab7849412fe9272bfd/resources-bank.php#L19-L44
In addition to the suggestion I originally posted in this issue about using the value of get_row_layout()
as part of the partial path directly, another suggestion I have is to move this logic into its own template part. Maybe something like header_select.php
that just contains this logic. That way you're not repeating it all a bunch.
Just a few small cleanup notes.
$counter
isn't used as far as I can tell, can be removed. https://github.com/Myzwer/foothillschurch/blob/effc5bbf81497ae99f0561ab7849412fe9272bfd/form-success.php#L31else
isn't needed unless you actually have something to put in the else block. https://github.com/Myzwer/foothillschurch/blob/effc5bbf81497ae99f0561ab7849412fe9272bfd/form-success.php#L81This is just a suggestion of an alternative way of handling flexible content layouts like this. https://github.com/Myzwer/foothillschurch/blob/effc5bbf81497ae99f0561ab7849412fe9272bfd/form-success.php#L35-L78
You could use the name of the layout as a template partial name. For example, you could create
components/calls-to-action/primary_cta.php
, etc... Then, in your code call it like thisIt's just an option if you want to cleanup this file a bit and keep those layouts separate as individual components.