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
/** | |
* Check if the cover block has the hero class and set a global variable. | |
* | |
* @param string $content The block content about to be rendered. | |
* | |
* @return string | |
*/ | |
function otk_cover_block( string $content ): string { | |
// The hero is the first block in the content, so we set it once. |
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
// Desired output | |
// .woocommerce-page.single-product main .product_cat-intentional-pause form.cart #wc-stripe-payment-request-wrapper | |
.woocommerce-page.single-product { | |
main { | |
form.cart { | |
#wc-stripe-payment-request-wrapper { | |
$selector: nth(&,1); // Current element | |
$grandparent: nth($selector, -2); // Grandparent selector |
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
// Desired output | |
// .content-section-about_this .wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__content | |
.content-section-gift, | |
.content-section-about_this { | |
.wp-block-media-text { | |
$selector: nth(&,1); | |
$direct-parent: nth($selector, length($selector)); | |
&.is-stacked-on-mobile #{selector-append($direct-parent, '__content')} { |
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
<?php | |
/* | |
Plugin Name: OtakuPahp Security Measures | |
Description: Some Wordpress Hacks to improve site security | |
Author: Pablo Hernandez (OtakuPahp) | |
Author URI: https://otakupahp.llc | |
Version: 1.0.0 | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { |
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
<?php | |
/** | |
* Calculate the distance between the 2 locations | |
* | |
* @param array $point_a | |
* @param array $point_b | |
* | |
* @return float | |
*/ | |
function calculate_distance( array $point_a, array $point_b ) : float { |
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
-- Replace table name as needed | |
SELECT * FROM `wp_options` WHERE `option_name` LIKE '%jetpack_search%' ORDER BY option_name ASC; |
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
#!/bin/bash | |
TARGET="/www/{site-folder}/public/wp-content/themes" | |
GIT_DIR="/www/{site-folder}/private/warp.git" | |
BRANCH="main" | |
while read oldrev newrev ref | |
do | |
# only checking out the master | |
if [[ $ref = refs/heads/$BRANCH ]]; | |
then |
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
<?php | |
/** | |
* Adds support for 'integrity' and 'crossorigin' | |
* | |
* This relies on the function *wp_script_add_data* been called when enqueuing the script | |
* | |
* @param $tag | |
* @param $handle | |
* |
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
<?php | |
class Collection implements Iterator, ArrayAccess | |
{ | |
private int $position; | |
private array $array = []; | |
public function __construct() { | |
$this->position = 0; |
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
.container { | |
height: 300px; | |
width: 300px; | |
margin: 0 auto; | |
display: flex; | |
justify-content: center; | |
align-content: center; | |
} | |
.loader { |
NewerOlder