The Definitive Guide to Setting Up WordPress in 2024: A Bristol Freelance Web Developer’s Essential Setup
In the ever-evolving landscape of website development, staying ahead of the curve...
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 ever-evolving landscape of website development, staying ahead of the curve...
In the digital realm, your website serves as the cornerstone of your...
In the ever-evolving world of e-commerce, having a robust and flexible platform...
Get the featured image dimensions (width and height) in WordPress. Paste the following code in the single.php file. <?php $post_id...
For me, the ACF plugin is a standard install for every WordPress project. Its a great tool for developers to...
You can use the following method in php to create a conditional that checks if a url has http or...