Why I Love WordPress
In the early days (2003), WordPress was essentially a blogging tool and...
24.Jun.2017 | Code Snippets, Wordpress
A quick way to remove empty p tags from custom shortcodes in WordPress.
<?php
add_filter("the_content", "the_content_filter");
function the_content_filter($content) {
$block = join("|",array("shortcode1","shortcode2","shortcode3"));
$rep = preg_replace("/( <p> )?\[( $block )(\s[^\]]+)?\](<\/p>|<br \/>)?/", "[$2$3]", $content);
$rep = preg_replace("/( <p> )?\[\/( $block )](<\/p>|<br \/>)?/","[/$2]",$rep);
return $rep;
}
Credit: https://gist.github.com/bitfade
PHP, Wordpress Function, WordPress Tips
Share
In the early days (2003), WordPress was essentially a blogging tool and...
To allow the editor user role to have full access to Gravity...
Add this code to your functions.php file to add the dimensions to...
Add this code to your functions.php file to add the dimensions to the image object array for svgs. add_filter( 'wp_get_attachment_image_src',...
Here is a really simple way to create custom tabs for your WooCommerce builds using the ACF Repeater Field. First,...
A quick snipped of code filter parameters into YouTube oEmbed requests. Handy to remove suggested videos, YouTube contols and info....