This has been moved to github.com/kasparsd/wp-docs-md →
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 | |
| class Systeme_API { | |
| const API_URL = 'https://api.systeme.io/api'; | |
| public function __construct( private string $api_key ) {} | |
| private function url_to( string $endpoint, ?array $params = [] ): string { | |
| $url = sprintf( '%s/%s', self::API_URL, ltrim( $endpoint, '/' ) ); |
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: Transient Autoload | |
| * Description: Autoload transients with expiration since they're not preloaded by WP core. | |
| * Version: 1.0.0 | |
| */ | |
| namespace Transient_Autoload; | |
| function get_transient_option(): array { |
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 | |
| add_filter( 'render_block', function( $block_content, $block ) { | |
| if ( empty( $block['blockName'] ) ) { | |
| return $block_content; | |
| } | |
| $supports = []; |
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 | |
| /* | |
| Term Archive Pages: | |
| - http://example.com/recipes/dinner/ | |
| - http://example.com/recipes/breakfast,brunch/ | |
| Single Recipe Pages: | |
| - http://example.com/recipes/dinner/soup-title/ |
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 | |
| // Remove the wp_title filter | |
| add_action( 'init', 'remove_wpseo_title_rewrite' ); | |
| function maybe_remove_wpseo_title_rewrite() { | |
| global $wpseo_front; | |
| remove_filter( 'wp_title', array( $wpseo_front, 'title' ), 15 ); | |
| } |
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 () { | |
| function initLazyVideos() { | |
| var videos = document.querySelectorAll("video[data-src]"); | |
| if ("IntersectionObserver" in window) { | |
| var observer = new IntersectionObserver( | |
| function (entries, observer) { | |
| entries.forEach(function (entry) { | |
| if (entry.isIntersecting) { | |
| var video = entry.target; |
Update: please note that I have since switched to using a set of bash scripts instead of poluting the Git repository with git svn.
Author: Kaspars Dambis
kaspars.net / @konstruktors
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
| map $cookie_skip_http_auth $auth_type { | |
| default "Restricted Area"; | |
| "123" "off"; | |
| } | |
| server { | |
| location /setauthcookie { | |
| add_header Set-Cookie "skip_http_auth=123"; | |
| return 301 http://example.com; | |
| } |
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 | |
| add_action( | |
| 'login_head', | |
| function () { | |
| $site_icon_url = get_site_icon_url(); | |
| if ( ! empty( $site_icon_url ) ) { | |
| printf( | |
| '<style type="text/css"> |
NewerOlder
