tags from wordpress shortcodes via a php functon
Looking for a php function (non-jQuery or wpautop modification) approach to remove from within wordpress.
I tried this but it does not w
What you need is a mix of jquery and php... that is the only working way
that i found to be working really well. i have tutorial on my site but
in order to keep stuff inhouse here goes
The jQuery:
include this in some JS file you already enqueue
jQuery(function($){
$('div#removep > p').filter(function() {
return $.trim($(this).text()) === '' && $(this).children().length == 0
})
.remove()
})
A shortcode you can later use:
in your functions.php or included file
function sght_removep( $atts, $content = null ) {return ''.do_shortcode($content).'';}
add_shortcode('removep', 'sght_removep');
Now you can wrap specific stuff like this:
[removep]
Some text i write directly in wordpress wysiwyg
<-- this would get removed
[/removep]
This solution requires some know how but it works!
Hope this helps...