Allow for custom namespaced elements #139
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I don't know if this is the right way to go about this, but we noticed that the 1.8.0 update broke our custom elements and we believe the root of it is because of the explicit model update and the check for
tailor:tailor_[element]
inside ofclass-models.php
.There are couple things to note for our usage of Tailor:
We apply the filter
add_filter( 'tailor_save_content_as_html', '__return_false' );
in order to make sure that the post_content stores the shortcodes as apposed to the rendered HTML.We namespace our components
ss_[element]
(for Sprout Social) which has always worked since we've started to use Tailor. Heres some example code for our plugin:class-avatar.php
then initializing inside of our
tailor-sprout-components.php
:Without the proposed changes we noticed that the canvas isn't rendering anything:
But with the changes we see that it actually runs the
generate_models_from_html
function:This PR does not break any existing default Tailor components and will continue let us use our namespaced elements, I'd love to be able to update all of our custom elements to be
tailor_[our element]
but we have 300 pages already built with our existing components and don't want to break those.Do let me know if this makes sense, or if you need more clarification. We have a very odd way of using Tailor, haha.