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

Quick fix: break issue in eo_template_stack() loop #434

Closed
lmoffereins opened this issue Jun 4, 2018 · 3 comments
Closed

Quick fix: break issue in eo_template_stack() loop #434

lmoffereins opened this issue Jun 4, 2018 · 3 comments

Comments

@lmoffereins
Copy link

lmoffereins commented Jun 4, 2018

In eo_locate_template() there's a wonderful way to override theme templates. Unfortunately, the loop for locating the template files fails on the line after which $located is defined: it breaks only the first foreach, not the entire loop. This results in the loop always searching for the last $template_name, even when a higher prioritized template file was already found before.

Suggested fix: apply break 2; instead of just break; directly after locating the template file.

Easy win!

@stephenharris
Copy link
Owner

Hi @lmoffereins - good spot, but do have an actual example of this? The plug-in uses just passes one template name, and the few exceptions where it passes an array, the latter template names do not exist (e.g. widget-event-list.php exists, but event-list.php does not).

@lmoffereins
Copy link
Author

@stephenharris While your plugin functions just fine on its own, I'm using eo_locate_template() in my plugin to extend EO itself. There I'd like to provide a set of template naming options, similar to how bbPress uses its templating system. This would allow authors of themes or other plugins to choose their own template specificity while also providing the opton to fallback to EO's own templates.

@stephenharris
Copy link
Owner

Thanks! I'll be fixing this in the next update.

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

No branches or pull requests

2 participants