Search code examples
pythondjango-cms

How to add classes to django-cms text plugin


I am putting the text plugin in a

tag which has its classes and style. but when adding the text in text plugin it creates a

tag for it self. So, it is not getting the styles I want it to get is there a way to remove

tag placed by the text plugin or add classes to it?

HTML:

{% load cms_tags menu_tags sekizai_tags %}
{% load static %}
<!DOCTYPE html>
<html lang="en">
<body>
<p class="post-meta">
Posted on {% block post_date1 %}{% placeholder "post_date1" %}{% endblock post_date1 %}
</p>
</body>

result

<!DOCTYPE html>
<html lang="en">
<body>
<p class="post-meta">
Posted on <p> November, 20, 2020</p>
</p>
</body>

Solution

  • The way the text editor works, it'll create that default paragraph from your content.

    The easiest thing for you to do is change your template to;

    {% load cms_tags menu_tags sekizai_tags %}
    {% load static %}
    <!DOCTYPE html>
    <html lang="en">
    <body>
    {% block post %}{% placeholder "post" %}{% endblock post %}
    </body>
    

    Then when you add the content to the plugin, add the post-meta class to the paragraph tag using the source view of the text editor.