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 | |
// Your themes functions.php | |
add_action( 'init', function() { | |
add_rewrite_rule( | |
'recipe/([0-9]+)/?$', | |
'index.php?pagename=recipe&recipe_id=$matches[1]', | |
'top' ); | |
}); |
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 | |
//... | |
// This will usually be received from an env variable, for example $connectionString = getenv('DB_URL'); | |
$connectionString = 'mysql://user:password@foo-bar.rds.amazonaws.com:3306/database'; | |
// The values below will be your default values if $connectionString is empty. | |
$dbConfig = array_merge( | |
[ | |
'host' => 'localhost', |
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 | |
/** | |
* Helper function to get sanitized field | |
* and also normalize values. | |
* | |
* @param $field_key | |
* @param bool $post_id | |
* @param bool $format_value | |
* @param string $sanitization_method esc_html / esc_attr or NULL for none | |
* @return array|bool|string |
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 | |
/* | |
Plugin Name: Infogram oEmbed | |
Plugin URI: | |
Description: Adds oEmbed support for infogr.am and infogram.com urls. | |
Author: khromov | |
Version: 1.0 | |
Author URI: https://khromov.se | |
*/ |
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 | |
/** | |
* Shortcode for displaying a link from the ACF Link Picker addon. | |
* | |
* Usage: | |
* [acf_link_picker] | |
* -or- | |
* [acf_link_picker field="myfield"] | |
*/ | |
add_shortcode( 'acf_link_picker', function ( $atts, $content = '' ) { |
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: Fix broken Instagram oEmbed | |
* Description: Fixes an issue with Instagram posts being broken when multiple posts are oEmbedded. | |
* Version: 1.0 | |
* Author: khromov | |
*/ | |
/** | |
* Remove Instagram embed.js script on each embed |
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'; |