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 | |
add_action( 'wp_enqueue_scripts', 'my_block_enqueue_scripts' ); | |
function my_block_enqueue_scripts() { | |
wp_enqueue_style( 'my-normal-css' ); | |
// Do this only if the current post/page has an instance of the related block. | |
if ( has_block('my-block-name') ) { |
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 | |
add_action( 'get_header', function() { | |
if ( !is_attachment() ) return; | |
$file_url = wp_get_attachment_url( get_the_ID() ); | |
$file_name = basename( $file_url ); | |
header( sprintf('Content-type: %s', get_post_mime_type() ) ); |
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 | |
add_action( 'get_header', function() { | |
if ( !is_attachment() ) return; | |
$file_url = wp_get_attachment_url( get_the_ID() ); | |
wp_redirect( $file_url ); |
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
name: Publish to Production | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
web-deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get Code |
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 | |
add_action( 'wp_footer', function() { | |
if ( !is_attachment() ) return; | |
$file_url = wp_get_attachment_url( get_the_ID() ); | |
?><script> |
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 | |
add_action( 'rest_api_init', 'register_form_shortcode' ); | |
function register_form_shortcode() { | |
register_rest_route( 'mdg/v1', '/events', [ | |
'methods' => 'GET', | |
'callback' => 'get_shortcode_html', | |
'permission_callback' => '__return_true', |
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 | |
function build_ical( array $input, string $output_path ) { | |
$template = file_get_contents( __DIR__ . '/template.ics' ); | |
$timezone = new DateTimeZone('America/New_York'); | |
$now = new DateTime( 'now', $timezone ); | |
$start = new DateTime( $input['start'], $timezone ); |
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 mdgSMTP { | |
public static function setup() { | |
add_action( 'phpmailer_init', [ __CLASS__, 'configure_php_mailer' ] ); | |
if ( class_exists('WP_CLI') ) { | |
WP_CLI::add_command( 'send-test-email', [ __CLASS__, 'send_test_email' ] ); |
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
.project-cards { | |
margin: 2em 0; | |
} | |
.project-card { | |
margin: .5em 0; | |
/* border: 1px solid #444; */ | |
background: hsla(0, 0%, 0%, .1); | |
padding: .5em .5em .5em 2em; | |
position: relative; |
NewerOlder