Created
April 30, 2020 19:53
-
-
Save fertek/fd66d621405773a1029331dc80d255ab to your computer and use it in GitHub Desktop.
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
function jf_additional_post_processing( $processed_site_dir ) { | |
$iterator = new RecursiveIteratorIterator( | |
new RecursiveDirectoryIterator( | |
$processed_site_dir, | |
RecursiveDirectoryIterator::SKIP_DOTS | |
) | |
); | |
foreach ( $iterator as $filename => $file_object ) { | |
$file_contents = file_get_contents( $filename ); | |
$rewritten_contents = str_replace( | |
'old', | |
'new', | |
$file_contents | |
); | |
file_put_contents( $filename, $rewritten_contents ); | |
} | |
\WP2Static\WsLog::l( | |
'Finished my additional post-processing.' | |
); | |
} | |
add_action( 'wp2static_post_process_complete', 'jf_additional_post_processing', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment