Reusable Template Part smart action has an issue with hyphens

Pinegrow tries to use the first hyphenated word as the slug in the get_template_parts() function when I have a Reusable Template Part saved in a folder with a hyphen.

For example, I have a partial saved in template-parts/content/content.php and when I use the Reusable Template Part smart action, it generates the code:

<?php get_template_part( 'template', 'parts/content/content' ); ?>

when it should be

<?php get_template_part( 'template-parts/content/content' ); ?>

Changing the smart action to a regular get_template_part() action also splits it incorrectly, but at least it lets me correct it manually.

Interestingly, this behavior doesn’t happen when I have a hyphen in the ‘name’ portion of the partial file, although I still end up using the non-smart action to split the slug and name the way I want.

This is an issue since WordPress guidelines suggest that we put partials in the /template-parts directory.

1 Like

I didn’t notice that at all but you’re right. Nice find @adamslowe