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 | |
| /** | |
| * Plugin Name: TGM API Helper | |
| * Plugin URI: https://thomasgriffin.io | |
| * Description: Whitelists the plugins to be loaded during API requests to reduce overhead. | |
| * Author: Thomas Griffin | |
| * Author URI: https://thomasgriffin.io | |
| * Version: 1.0.0 | |
| */ |
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() { | |
| tinymce.create('tinymce.plugins.typekit', { | |
| init: function(ed, url) { | |
| ed.onPreInit.add(function(ed) { | |
| // Get the iframe. | |
| var doc = ed.getDoc(); | |
| // Create the script to inject into the header asynchronously. | |
| var jscript = "(function() { | |
| var config = { |
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 // Do not include this opening PHP tag. | |
| add_filter( 'mce_external_plugins', 'tgm_io_typekit_plugin' ); | |
| /** | |
| * Adds an external TinyMCE plugin to be loaded into the TinyMCE editor. | |
| * | |
| * @since 1.0.0 | |
| * | |
| * @param array $plugins Default array of plugins to be loaded by TinyMCE. | |
| * @return array $plugins Amended array of plugins to be loaded by TinyMCE. | |
| */ |
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() { | |
| tinymce.create('tinymce.plugins.typekit', { | |
| init: function(ed, url) { | |
| ed.onPreInit.add(function(ed) { | |
| // Get the iframe. | |
| var doc = ed.getDoc(); | |
| // Create the script to inject into the header asynchronously. | |
| var typekit = 'xxxxxx', // PLACE YOUR TYPEKIT KIT ID HERE! | |
| jscript = "!function(){var t={kitId:\"" + typekit + "\"},e=!1,a=document.createElement(\"script\");a.src=\"//use.typekit.net/\"+t.kitId+\".js\",a.type=\"text/javascript\",a.async=\"true\",a.onload=a.onreadystatechange=function(){var a=this.readyState;if(!(e||a&&\"complete\"!=a&&\"loaded\"!=a)){e=!0;try{Typekit.load(t)}catch(c){}}};var c=document.getElementsByTagName(\"script\")[0];c.parentNode.insertBefore(a,c)}();"; |
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
| alter table `wp_usermeta` add index `ndx_meta_key_meta_val1` (`meta_key`(40), `meta_value`(191)); | |
| alter table `wp_postmeta` add index `ndx_meta_key_meta_val1` (`meta_key`(40), `meta_value`(191)); | |
| alter table `wp_termmeta` add index `ndx_meta_key_meta_val1` (`meta_key`(40), `meta_value`(191)); | |
| alter table `wp_commentmeta` add index `ndx_meta_key_meta_val1` (`meta_key`(40), `meta_value`(191)); | |
| alter table `wp_edd_customermeta` add index `ndx_meta_key_meta_val1` (`meta_key`(40), `meta_value`(191)); | |
| alter table `wp_edd_licensemeta` add index `ndx_meta_key_meta_val1` (`meta_key`(40), `meta_value`(191)); | |
| alter table `wp_posts` add index `ndx_id_post_status_val1` (`id`, `post_status`); | |
| SELECT 'autoloaded data in KiB' as name, ROUND(SUM(LENGTH(option_value))/ 1024) as value FROM wp_options WHERE autoload='yes' | |
| UNION |
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_filter( 'optin_monster_data', 'tgm_om_turn_off_tracking' ); | |
| function tgm_om_turn_off_tracking( $data ) { | |
| $data['tracked'] = true; | |
| return $data; | |
| } |
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_action( 'tgmsp_before_slider_output', 'tgm_custom_slider_theme' ); | |
| function tgm_custom_slider_of_madness( $id ) { | |
| // If not the proper slider ID, do nothing. Change to match your slider ID. | |
| if ( '324' !== $id ) return; | |
| // Dequeue the default styles. | |
| wp_dequeue_style( 'soliloquy-style' ); | |
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
| /** | |
| * The code below renders additional custom attachment fields into the | |
| * new media manager. | |
| * | |
| * I am assuming you are using your own custom media modal frame. By | |
| * extending the default Attachment.Details subview, we can append our | |
| * custom fields to the default fields listed. | |
| * | |
| * In the initialize function, we ensure that our changes are always up | |
| * to date by "listening" to our model's change event and updating the |
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 | |
| function test_unoptimized_query() { | |
| $time_start = microtime( true ); | |
| $posts = new WP_Query( array( 'posts_per_page' => -1 ) ); | |
| return number_format( microtime( true ) - $time_start, 10 ); | |
| } | |
| function test_optimized_query() { | |
| $time_start = microtime( true ); | |
| $posts = new WP_Query( array( 'posts_per_page' => -1, 'no_found_rows' => true ) ); |
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
| <script type="text/javascript"> | |
| var OptinMonsterCustomVariables = function(app) { | |
| /** | |
| * API method for deleting a custom variable. Must be accessed via the app object. | |
| * | |
| * @param string $key The custom variable to delete. | |
| * @return null | |
| */ | |
| app.deleteCustomVariable('foo'); | |
| }; |
NewerOlder