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 | |
/** | |
* Simple Website Redirect - Not Homepage | |
* | |
* @package SimpleWebsiteRedirectNotHomepage | |
* @author Micah Wood | |
* @copyright Copyright 2022 by Micah Wood - All rights reserved. | |
* @license GPL2.0-or-later | |
* |
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
name: Cypress Tests | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
types: [opened, edited, synchronize, reopened, ready_for_review] | |
pull_request_review: | |
types: [submitted, edited] |
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
Cypress.Commands.add('login', () => { | |
// Fetch username and password from the cypress.env.json file. | |
const username = Cypress.env('wpUsername'); | |
const password = Cypress.env('wpPassword'); | |
cy | |
.getCookies() | |
.then(cookies => { | |
let hasMatch = false; |
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 | |
$strings = [ | |
'One Two Three Four Five Six Seven Eight Nine Ten Eleven Twelve', | |
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua', | |
'Bacon ipsum dolor amet burgdoggen biltong pastrami, kielbasa sirloin strip steak cupim andouille tenderloin.', | |
'Hodor. Hodor hodor, hodor. Hodor hodor hodor hodor hodor. Hodor. Hodor! Hodor hodor, hodor; hodor hodor hodor.', | |
'Lorem Ipsum is the single greatest threat. We are not - we are not keeping up with other websites.', | |
'Cupcake ipsum dolor. Sit amet marshmallow topping cheesecake muffin.', | |
'This test is short.', |
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 | |
/** | |
* Maintenance Mode | |
* | |
* @package MaintenanceMode | |
* @author Micah Wood | |
* @copyright Copyright 2022 by Micah Wood - All rights reserved. | |
* @license GPL2.0-or-later | |
* | |
* @wordpress-plugin |
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
name: Deploy Website | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
deploy: | |
name: Deploy |
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 | |
/** | |
* Custom Rest URL | |
* | |
* @package CustomRestUrl | |
* @author Micah Wood | |
* @copyright Copyright 2021 by Micah Wood - All rights reserved. | |
* @license GPL2.0-or-later | |
* |
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 | |
$cache_key = 'my_api_call_response'; | |
$response = get_transient( $cache_key ); | |
if ( ! $response ) { | |
$response = wp_remote_get('https://example.com/api/v1/endpoint'); | |
$status_code = (int) wp_remote_retrieve_response_code( $response ); | |
$body = wp_remote_retrieve_body( $response ); | |
$data = json_decode( $body, true ); | |
if ( 200 === $status_code && $data ) { |