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 | |
/** | |
* Given a URL to an image maybe sideload into the media library | |
* | |
* @param string $url The URL to sideload into the media library | |
* @param string $name The title to associate with the image | |
* @param integer $associated_post_id The post ID to associate the sideloaded image to | |
*/ | |
function maybe_sideload_image( $url = '', $name = '', $associated_post_id = 0 ) { | |
require_once ABSPATH . 'wp-admin/includes/media.php'; |
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
@use "sass:math"; | |
// via https://css-tricks.com/snippets/sass/px-to-em-functions/ | |
$browser-context: 16; | |
@function rem($pixels) { | |
@if (unitless($pixels)) { | |
$pixels: $pixels * 1px; | |
} |
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 | |
/** | |
* Search post attachments where the given filename matchs the attached file path | |
* | |
* @link https://wordpress.stackexchange.com/a/405142/2744 | |
* | |
* @param string $filename The filename to search | |
* | |
* @return int The attachment ID of the first result sorted by post_date in reverse chronological order (most recent first) | |
*/ |
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 | |
// Merge the expected data with the data recieved | |
$expected_data = array( | |
'timestamp' => '', | |
'foo' => '', | |
'bar' => '', | |
'baz' => '', | |
); | |
$data = array_merge( $expected_data, $_REQUEST ); |
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 rh_filter_the_content( $the_content = '' ) { | |
$blocks = parse_blocks( $the_content ); | |
$new_block = array( | |
'blockName' => 'core/paragraph', | |
'attrs' => array(), | |
'innerBlocks' => array(), | |
'innerHTML' => '<p>Hello World</p>', | |
'innerContent' => array( | |
'<p>Hello World</p>', |
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 rh_filter_the_content( $the_content = '' ) { | |
$blocks = parse_blocks( $the_content ); | |
$new_block = array( | |
'blockName' => 'core/paragraph', | |
'attrs' => array(), | |
'innerBlocks' => array(), | |
'innerHTML' => '<p>Hello World</p>', | |
'innerContent' => array( | |
'<p>Hello World</p>', |
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 rh_filter_the_content( $the_content = '' ) { | |
$blocks = parse_blocks( $the_content ); | |
$new_block = array( | |
'blockName' => 'core/paragraph', | |
'attrs' => array(), | |
'innerBlocks' => array(), | |
'innerHTML' => '<p>Hello World</p>', | |
'innerContent' => array( | |
'<p>Hello World</p>', |
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
FROM php:8.1-apache | |
RUN apt-get update --fix-missing \ | |
&& apt-get install -y --no-install-recommends \ | |
vim \ | |
git \ | |
subversion \ | |
libopencv-dev \ | |
libwebp-dev \ | |
libgif-dev \ |
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: Show All Post Type Archives | |
* Description: Add support for /all/ after a post type archive | |
* Version: 0.0.1 | |
* Plugin URI: https://gist.github.com/kingkool68/efa01ecff91bc722cd3f667ae509a37b | |
* Author: Russell Heimlich | |
* Author URI: https://github.com/kingkool68 | |
*/ | |
class RH_Show_All_Archives { |
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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
# Block _method=GET query string used for compatibility in the REST API | |
# See https://developer.wordpress.org/rest-api/using-the-rest-api/global-parameters/#_method-or-x-http-method-override-header | |
RewriteCond %{QUERY_STRING} \b_method=GET\b [NC] | |
RewriteRule ^ - [F] | |
</IfModule> |
NewerOlder