[IMPROVEMENT] - Getting project version and name won't work in the case of a plugin #386
Labels
feature request
New feature request
improvement
Small improvement fixes, either readability or performance improvements
So, while the solution for streamlining the project version and name from the
wp_get_theme
object works great if we have a theme, in the case of a plugin, there could be some issues, as these would returnfalse
.eightshift-libs/src/Config/ConfigExample.php
Line 30 in aebc4ae
The solution would be to check if the project is a theme or a plugin (something like, check 3 directories from the config file, and if that is
plugins
it's a plugin, if it's athemes
it's a theme), then either call the above code, or useget_plugin_data()
function to get the information about the plugin from the plugin headerPOC would be like (inside the
Config
class):Then, using that helper you'd use it in the
getProjectName()
method likeEDIT: the last part would return a camelCased string, instead of the text domain, which is usually a lower cased dash separaed string.
The text was updated successfully, but these errors were encountered: