This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$text = 'I love eating CO2 for breakfast. <a href="http://www.co2health.com" class="co2" id="co2">CO2 health effects</a>. Here is a pic of CO2 <img src="http://site.com/co2.jpg" alt="CO2">'; | |
$text = preg_replace('~<[^>]*>(*SKIP)(*F)|CO2~', 'CO<sub>2</sub>', $text); | |
echo $text; | |
/* | |
Output: | |
I love eating CO<sub>2</sub> for breakfast. <a href="http://www.co2health.com" class="co2" id="co2">CO<sub>2</sub> health effects</a>. Here is a pic of CO<sub>2</sub> <img src="http://site.com/co2.jpg" alt="CO2"> | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Name file anything you want and put in put in wp-content/mu-plugins/ | |
Credits: | |
https://wycks.wordpress.com/2013/12/05/how-to-remove-error-notices-using-wordpresss-wp_debug/ | |
*/ | |
error_reporting(E_ALL & ~( E_NOTICE | E_USER_NOTICE | E_STRICT | E_DEPRECATED | E_USER_DEPRECATED | E_WARNING | E_CORE_WARNING | E_USER_WARNING | E_COMPILE_WARNING | E_PARSE )); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$subject = '<a href="#" data-type="page" data-value="1" data-title="Dickbutt"></a>'; | |
preg_match_all( | |
'/<a | |
(?:\s+ | |
(?: | |
href=["\'](?P<href>[^"\'<>]+)["\'] | |
| | |
data-value=["\'](?P<value>[^"\'<>]+)["\'] | |
| | |
data-title=["\'](?P<title>[^"\'<>]+)["\'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wpbase_remove_admin_bar_glitch(){ | |
// make sure body is not relative positioned | |
if ( is_admin_bar_showing() ) { ?> | |
<style type="text/css"> body { position: static !important; } </style> | |
<?php } | |
} | |
add_action('wp_head', 'wpbase_remove_admin_bar_glitch'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* | |
* Adds location rule to target specific sites in a WordPress Multisite environment | |
* http://www.advancedcustomfields.com/resources/custom-location-rules/ | |
* | |
*/ | |
function acf_location_rule_type_blog( $choices ) { |