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 | |
/** | |
* Create a Google Maps oEmbed Provider using the Google Maps Embed API | |
* | |
* @see https://developers.google.com/maps/documentation/embed/ | |
* @link https://gist.github.com/soderlind/db6dae8a73253329bc97ac50d7ebedef | |
* @since 1.0.0 | |
* @package Google_Maps_oEmbed_Provider | |
*/ | |
class DSS_oEmbed_Add_Provider { |
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
// Place this in wp-config | |
define( 'ACF_5_KEY', 'yourkeyhere' ); | |
// Set ACF 5 license key on theme activation. Stick in your functions.php or equivalent. | |
function auto_set_license_keys() { | |
if ( ! get_option( 'acf_pro_license' ) && defined( 'ACF_5_KEY' ) ) { | |
$save = array( | |
'key' => ACF_5_KEY, |
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: in_reply_to_status_id | |
* Version: 0.1 | |
* Plugin URI: https://gist.github.com/soderlind/0a0a439304442b64580ee02687e1a8d8 | |
* Description: returns twitter thread | |
* Author: Per Soderlind | |
* Author URI: https://soderlind.no | |
*/ |
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 | |
/** | |
* Sample use: | |
* WordPres Customizer is dependant on functionality in the theme. Just in case | |
* the current theme doesn't support WordPress Customizer we'll use a theme | |
* that supports it. | |
*/ | |
class NN { | |
private $theme_name = 'twentysixteen'; |
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 | |
$current_theme = wp_get_theme(); // get WP_Theme object | |
if ( count( $post_templates = $current_theme->get_post_templates() ) ) { // https://developer.wordpress.org/reference/classes/wp_theme/get_post_templates/ | |
printf( '<pre>%s</pre>', print_r( $post_templates, true ) ); | |
} | |
/* | |
Prints: |
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
<?xml version="1.0"?> | |
<ruleset name="Plugin Customizer"> | |
<description>The code standard for Plugin Customizer in WordPress.</description> | |
<!-- ##### WordPress sniffs #####--> | |
<rule ref="WordPress-Core"> | |
<exclude name="Generic.Files.LowercasedFilename" /> | |
<exclude name="WordPress.Files.FileName" /> | |
<exclude name="WordPress.Files.FileName.UnderscoresNotAllowed" /> | |
</rule> |
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_filter( 'the_content', function ( $content ) { | |
$doc = new DOMDocument(); | |
// modify state | |
$libxml_previous_state = libxml_use_internal_errors( true ); | |
$doc->loadHTML( $content ); | |
// handle errors | |
libxml_clear_errors(); | |
// restore |
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_filter( 'the_content', function ( $content ) { | |
$doc = new DOMDocument(); | |
// modify state | |
$libxml_previous_state = libxml_use_internal_errors( true ); | |
$doc->loadHTML( $content ); | |
// handle errors | |
libxml_clear_errors(); | |
// restore |
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( 'customize_controls_enqueue_scripts', 'add_lang_to_customizer_previewer' ); | |
/** | |
* If Polylang activated, set the preview url | |
* | |
* @author soderlind | |
* @version 1.0.0 | |
*/ | |
function add_lang_to_customizer_previewer() { |
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: Add All Super-Admins to a New Site | |
* Description: Will attempt to add all super-admins to a site when it's created. | |
* Version: 0.1.0 | |
* Plugin URI: https://gist.github.com/soderlind/b0a7abc91eaa2646db38b81acfb532a1 | |
* Author: Per Soderind | |
* Author URI: https://soderlind.no | |
* Requires PHP: 7.0.0 | |
*/ |