Last active
April 4, 2025 20:09
-
-
Save circlecube/3330eaba952d1f8778f46f3f0d24624b to your computer and use it in GitHub Desktop.
Solutions Filter for Local Development
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: Solutions Filter | |
* Description: Solutions Filter for WordPress | |
* Version: 1.0.0 | |
* Author: Newfold Labs | |
* Author URI: https://www.newfold.com | |
* License: GPL-2.0+ | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt | |
*/ | |
add_filter( 'pre_transient_newfold_solutions', | |
function () { | |
// Use a json fixture rather than hiive entitlement endpoint response | |
$allowed_solutions = array( 'commerce', 'service', 'creator', 'none' ); | |
if ( in_array( $_GET['solution'], $allowed_solutions ) ) { | |
$fixture = NFD_SOLUTIONS_DIR . '/tests/cypress/fixtures/' . $_GET['solution'] . '.json'; | |
if ( file_exists( $fixture ) && is_readable( $fixture ) ) { | |
return json_decode( file_get_contents( $fixture ), true ); | |
} | |
} | |
return false; | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment