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: Disable REST API for anonymous users | |
*/ | |
/** | |
* Remove all endpoints except SAML / oEmbed for unauthenticated users | |
*/ | |
add_filter( 'rest_authentication_errors', function($result) { | |
if ( ! empty( $result ) ) { |
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: Advanced Custom Fields: Nowhere location rules | |
Description: Adds a "Nowhere" location rule in ACF | |
*/ | |
add_filter('acf/location/rule_types', function($rules) { | |
$rules['Extra']['nowhere'] = 'Nowhere'; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width"> | |
<title>Rock, Paper, Scissors</title> | |
<style> | |
*{margin:0;padding:0;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}::selection{background:#fb9fe5;text-shadow:none}a{color:#0088CC;text-decoration:none;outline:0}a:hover{color:#005580}a img{border:none}img{max-width:100%}html{font-size:100%}body{padding:5%;font:300 1.25em/1.6 monospace;background:#fff;color:#000;}h1{font-family:"Helvetica Neue",sans-serif;line-height:1;font-weight:300;margin-bottom:1em;}.game{padding:2em;background:#eee;} |
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 | |
namespace Deployer; | |
require 'recipe/common.php'; | |
set('ssh_type', 'native'); | |
set('ssh_multiplexing', true); | |
// Set configurations | |
set('repository', 'git@github.com:user/repo.git'); |
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: Print taxonomy terms starting from specific slug | |
* Description: Usage: [print_taxonomy slug="product-category"] or <?php echo do_shortcode('[print_taxonomy slug="product-category"]'); ?> | |
*/ | |
add_shortcode('print_taxonomy', function($atts, $content) { | |
$atts = shortcode_atts( array( | |
'slug' => '', | |
), $atts, 'print_taxonomy' ); |
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( 'facetwp_facets', function($facets) { | |
//Load facets.json file located in theme folder | |
$imported_facets = json_decode(file_get_contents(trailingslashit(dirname(__FILE__)) . 'facets.json'), true); | |
//Import facets | |
foreach($imported_facets['facets'] as $single_facet) { | |
$facets[] = $single_facet; |
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 | |
require 'recipe/common.php'; | |
// Set configurations | |
set('repository', 'ssh://gogs@git.server.com:22/user/repo.git'); | |
set('shared_files', ['public/wp-config.php']); | |
set('shared_dirs', ['public/wp-content/uploads']); | |
set('writable_dirs', []); | |
set('keep_releases', 10); | |
set('composer_command', 'composer'); |
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 get_header(); ?> | |
<div class="container-fluid"> | |
<div class="content"> | |
<main role='main'> | |
<?php | |
$query_404 = new WP_Query(array( | |
'posts_per_page' => 1, | |
'post_type' => 'page', | |
'post_name' => '404-error' | |
)); |
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('get_sample_permalink_html', function($return, $id, $new_title, $new_slug) { | |
$post_type_object = get_post_type_object(get_post_type($id)); | |
//Append rewrite slug if it exists | |
if(isset($post_type_object->rewrite['slug'])) { | |
$url_append = '/' . $post_type_object->rewrite['slug']; | |
} | |
else { |
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('save_post', array($this, 'mark_parent_categories'), 11); | |
/** | |
* Marks parent categories automatically. Works with the ACF taxonomy selector as well. | |
* | |
* @return mixed | |
*/ | |
function mark_parent_categories($post_id) { | |
global $post; |