// set up
View::$view_dir = '/some/path';
// echos the view
View::render('relative/template', [
'var1' => 'data',
'var2' => 'more data'
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 LocalValetDriver | |
* | |
* This class demonstrates how we might go about proxying any missing local images to a remote host. i.e; the production | |
* site. This has been created with WordPress in mind but could be adjusted to work with any other system. | |
*/ | |
class LocalValetDriver extends WordPressValetDriver { |
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( 'relevanssi_content_to_index', 'acfcdt_relevanssi_support', 10, 2 ); | |
add_filter( 'relevanssi_excerpt_content', 'acfcdt_relevanssi_support', 10, 2 ); | |
function acfcdt_relevanssi_support( $content, $post ) { | |
/** | |
* Approach A (recommended): Using SQL to minimise database queries during Relevanssi's indexing process. | |
*/ | |
global $wpdb; |
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 CustomOrderEmail extends \WC_Email { | |
// This is a just a simple example. See \WC_Email and child classes for more examples | |
public function __construct() { | |
$this->id = 'custom_order_email'; | |
$this->title = 'Custom Order 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
<?php | |
add_filter( 'pre_option_elementor_maintenance_mode_mode', function ( $option ) { | |
$parameter = 'bypass_maintenance'; // change this to whatever you like | |
if ( isset( $_GET['bypass_maintenance'] ) and $_GET['bypass_maintenance'] ) { | |
return 0; // needs to be falsy but not FALSE | |
} |
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 | |
// register a top-level options page | |
if ( function_exists( 'acf_add_options_page' ) ) { | |
acf_add_options_page( [ | |
'page_title' => 'My Options Page', | |
'menu_title' => 'My Options Page', | |
'menu_slug' => 'my-options-page', | |
'capability' => 'edit_posts', | |
'parent_slug' => '', |
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( 'acf/settings/load_json', function ( $paths ) { | |
$paths[] = get_template_directory() . '/some/custom/dir'; | |
return $paths; | |
} ); |
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( 'acf/fields/wysiwyg/toolbars', function ( $toolbars ) { | |
$toolbars['Bare'] = []; | |
$toolbars['Bare'][1] = [ 'forecolor', 'link', 'strikethrough', 'bold', 'italic' ]; | |
return $toolbars; | |
} ); |
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 | |
use ACFCustomDatabaseTables\Intercept\ACFGetFieldIntercept; | |
use ACFCustomDatabaseTables\Vendor\Pimple\Container; | |
/** | |
* Class ACFCDTvOneDotZeroDotAnyGetFieldInterceptBypass | |
* | |
* This provides a 'hotfixed' approach for disabling custom database table intercept when using ACF's get_field() | |
* function. This will only work with version 1.0.x versions of the plugin as a built-in tool will be available in |