I am using Magnific Popup for an image gallery. However, the counter is displaying the HTML tags as plain text on the frontend.
Here is my configuration:
$(".open-popup").magnificPopup({
type: "image",
fixedContentPos: true,
gallery: {
enabled: true,
tCounter: '<span class="mfp-counter">%curr% of %total%</span>',
},
});
With the above configuration, the counter is showing the tag as plain text instead of rendering it properly.
Here is the CodePen link for reference:
I am using Magnific Popup for an image gallery. However, the counter is displaying the HTML tags as plain text on the frontend.
Here is my configuration:
$(".open-popup").magnificPopup({
type: "image",
fixedContentPos: true,
gallery: {
enabled: true,
tCounter: '<span class="mfp-counter">%curr% of %total%</span>',
},
});
With the above configuration, the counter is showing the tag as plain text instead of rendering it properly.
Here is the CodePen link for reference: https://codepen.io/swaranan/pen/PwYwoXK
Share Improve this question asked Nov 28, 2024 at 10:13 Swaranan Singha BarmanSwaranan Singha Barman 3471 silver badge15 bronze badges1 Answer
Reset to default 1You need to set the allowHTMLInTemplate
option to true
.
allowHTMLInTemplate
falseAvailable since 1.2.0. Allows HTML content in the source template (such as text under image). If you enable this - make sure your HTML attributes are sanitized if they can be created by a non-admin user.