Im trying to add filter but only when the_content is not empty. So I was trying do something like that:
<?php
$thecontent = get_the_content();
if(!empty($thecontent)) {
add_filter('the_content', 'gs_add_img_lazy_markup', 15);
} ?>
but without results. How should I do it propertly?
edit
What I want to do is create one function with two filters, but one this function should be done only when the_content is not empty. Right now I did this:
add_filter('the_content', 'content_image_markup', 15);
function content_image_markup($the_content) {
$thecontent = get_the_content();
if(!empty($thecontent)) {
// function content
}
}
add_filter('acf_the_content', 'acf_content_image_markup', 15);
function acf_content_image_markup($the_content) {
// the same function content what above
}
how to makes this easer?
gs_add_img_lazy_markup
function. – mrben522 Apr 18 at 17:57