Re-organization
This commit is contained in:
27
inc/util.php
Normal file
27
inc/util.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
// returns WordPress subdirectory if applicable
|
||||
function wp_base_dir() {
|
||||
preg_match('!(https?://[^/|"]+)([^"]+)?!', site_url(), $matches);
|
||||
if (count($matches) === 3) {
|
||||
return end($matches);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
// opposite of built in WP functions for trailing slashes
|
||||
function leadingslashit($string) {
|
||||
return '/' . unleadingslashit($string);
|
||||
}
|
||||
|
||||
function unleadingslashit($string) {
|
||||
return ltrim($string, '/');
|
||||
}
|
||||
|
||||
function add_filters($tags, $function) {
|
||||
foreach($tags as $tag) {
|
||||
add_filter($tag, $function);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user