This file contains hidden or 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
| function _remove_script_version( $src ){ | |
| $parts = explode( '?ver', $src ); | |
| return $parts[0]; | |
| } | |
| add_filter( 'script_loader_src', '_remove_script_version', 15, 1 ); | |
| add_filter( 'style_loader_src', '_remove_script_version', 15, 1 ); |
This file contains hidden or 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 | |
| /* | |
| * Dependent Plugin Activation/Deactivation | |
| * | |
| * Sources: | |
| * 1. https://pippinsplugins.com/checking-dependent-plugin-active/ | |
| * 2. http://10up.com/blog/2012/wordpress-plug-in-self-deactivation/ | |
| * | |
| */ | |
This file contains hidden or 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 | |
| $files = glob( __DIR__ . '/folder/*.php'); | |
| foreach ($files as $file) { | |
| require($file); | |
| } |
This file contains hidden or 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 to functions.php | |
| function fwp_combine_sources( $params, $class ) { | |
| if ( 'MY_FACET_NAME' == $params['facet_name'] ) { | |
| $value = get_field( 'YOUR_FIELD_1' ); | |
| $params['facet_value'] = sanitize_title( $value ); | |
| $params['facet_display_value'] = $value; | |
| $class->insert( $params ); |
This file contains hidden or 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
| // Add Async to JS deferred by Autoptimize plugin | |
| add_filter('autoptimize_filter_js_defer','my_ao_override_defer',10,1); | |
| function my_ao_override_defer($defer) { | |
| return $defer."async "; | |
| } |
This file contains hidden or 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 | |
| /** | |
| * @package Food_example_plugin | |
| * @version 1.0 | |
| */ | |
| /* | |
| Plugin Name: Food example plugin | |
| Plugin URI: http://wordpress.org/extend/plugins/# | |
| Description: This is an example plugin for WPMU DEV readers | |
| Author: Carlo Daniele |
This file contains hidden or 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
| /** | |
| * Basic example to pass values between parent and child components in React | |
| * Seems to be in line with this | |
| * http://stackoverflow.com/questions/24147331/react-the-right-way-to-pass-form-element-state-to-sibling-parent-elements | |
| * Now I have the state in parent and child. Is that good or bad? Why would I need it in child? | |
| * Could probably take that out | |
| * */ | |
| class Parent extends React.Component { | |
| constructor(props) { | |
| super(props); |
This file contains hidden or 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 | |
| /** | |
| * Export Data to CSV file | |
| * Could be used in WordPress plugin or theme | |
| */ | |
| // A sample link to Download CSV, could be placed somewhere in plugin settings page | |
| ?> | |
| <a href="<?php echo admin_url( 'admin.php?page=myplugin-settings-page' ) ?>&action=download_csv&_wpnonce=<?php echo wp_create_nonce( 'download_csv' )?>" class="page-title-action"><?php _e('Export to CSV','my-plugin-slug');?></a> |
This file contains hidden or 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
| (function($) { | |
| $(function() { | |
| wp.hooks.addFilter('facetwp/set_options/date_range', function(args) { | |
| // do something | |
| args.format = 'yyyy-mm-dd'; | |
| return args; | |
| }); | |
| }); | |
| })(jQuery); |