So I have the shortcode [my_example_shortcode] on my WordPress site.
add_shortcode( 'my_example_shortcode', 'shortcode_for_project' );
I want to prioritise the shortcode before
add_filter('the_content', 'my_example');
If the shortcode is not found on the page then I want the the code above to be applied.
I have already tried:
if (shortcode_for_project) {
echo do_shortcode('[my_example_shortcode]');
}
else
{
add_filter('the_content', 'my_example');
}
Let's say I have a page:
Business Intelligence
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sem magna, maximus eget odio vel, dictum ultrices nunc.
Then I want
add_filter('the_content', 'my_example');
to be enabled
But if
Business Intelligence
[my_example_shortcode]
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sem magna, maximus eget odio vel, dictum ultrices nunc.
Then I want
add_filter('the_content', 'my_example');
to be disabled
If I understand the problem here is one way you can do this: