This file contains hidden or 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 | |
/* | |
Plugin Name: WP-CFM SSOT | |
Description: Sets WP-CFM bundles as the Single Source of Truth. | |
*/ | |
// If this file is called directly, abort. | |
if ( ! defined( 'WPINC' ) ) { | |
die; | |
} |
This file contains hidden or 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 | |
/* | |
Plugin Name: WP-CFM SSOT | |
Description: Sets WP-CFM bundles as the Single Source of Truth for all tracked options. | |
*/ | |
// If this file is called directly, abort. | |
if ( ! defined( 'WPINC' ) ) { | |
die; | |
} |
This file contains hidden or 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 | |
// wp-content/mu-plugins/wp-cfm-multi-env.php | |
// ... | |
// Return empty array to disable multi-environment feature. | |
function my_wpcfm_multi_env_disable( $environments ) { | |
return []; | |
} | |
add_filter( 'wpcfm_multi_env', 'my_wpcfm_multi_env_disable' ); |
This file contains hidden or 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 | |
// wp-content/mu-plugins/wp-cfm-multi-env.php | |
// ... | |
function my_wpcfm_current_env_set( $env ) { | |
// Detect with your own code logic the current environment the WordPress site is running. | |
// Generally this will be defined in a constant inside `$_ENV` or `$_SERVER` super-globals. | |
// ... | |
$env = 'dev'; | |
return $env; |
This file contains hidden or 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 | |
// wp-content/mu-plugins/wp-cfm-multi-env.php | |
// ... | |
function my_wpcfm_multi_env_register( $environments ) { | |
// Define an array containing the hosting environment names. | |
// Or detect these with your own code logic if all are available in `$_ENV` or `$_SERVER` super-globals. | |
// ... | |
$environments = [ | |
'dev', |
This file contains hidden or 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 | |
/* | |
Plugin Name: WP-CFM Multi-environment | |
Description: Enables configuration management for multiple environments with WP-CFM. | |
*/ | |
// If this file is called directly, abort. | |
if ( ! defined( 'WPINC' ) ) { | |
die; | |
} |
This file contains hidden or 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 | |
/* | |
Plugin Name: WP All Import - Redirection AddOn | |
Description: Add a redirect for each post imported. | |
*/ | |
// If this file is called directly, abort. | |
if ( ! defined( 'WPINC' ) ) { | |
die; | |
} |
This file contains hidden or 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 correct_date_string( $str ) { | |
if ( $str ) { | |
$date = DateTime::createFromFormat('Y.m.d', $str); | |
return $date->format('m/d/Y'); | |
} else { | |
return ''; | |
} | |
} |
This file contains hidden or 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 | |
// Relates a post by title. | |
function rel_post_by_title( $title, $post_type ) { | |
// If we don't have a title to lookup, then return null; | |
if ( !$title ) return null; | |
// Check if related post already exists. If it doesn't then create it. | |
// Attempt to find page by value. | |
$page = get_page_by_title( $title, null, $post_type ); |
This file contains hidden or 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
function replaceUrlParam(url, paramName, paramValue) { | |
if (paramValue == null) { | |
paramValue = ''; | |
} | |
var pattern = new RegExp('\\b('+paramName+'=).*?(&|#|$)'); | |
if (url.search(pattern)>=0) { | |
return url.replace(pattern,'$1' + paramValue + '$2'); | |
} | |
url = url.replace(/[?#]$/,''); |
NewerOlder