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 | |
ini_set( 'MAX_EXEC_TIME', 120 ); | |
ob_start(); | |
$num_tests = 20; | |
$num_loops = 1000000; | |
$the_tests = array( | |
'++$i', |
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( 'template_include', 'ja_template_include' ); | |
/** | |
* Apply a template to all subcategories of a certain parent category. | |
* | |
* @author Jared Atchison | |
* @link http://www.jaredatchison.com/2011/10/02/taking-advantage-of-the-template_include-filter/ | |
* | |
* @param string $template Existing path to template file | |
* @return string Potentially amended path to template file |
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
/** Build all of the action links */ | |
$rendered .= '<p>'; | |
$rendered .= '<a href="' . add_query_arg( 'page', $this->menu, admin_url( 'themes.php' ) ) . '">' . __( 'Begin installing plugins', $this->domain ) . '</a> | '; | |
$rendered .= '<a href="' . admin_url( 'plugins.php' ) . '">' . __( 'Activate installed plugins', $this->domain ) . '</a> | '; | |
$rendered .= '<a class="dismiss-notice" href="' . add_query_arg( 'dismiss', 'dismiss_admin_notices' ) . '" target="_parent">' . __( 'Dismiss this notice', $this->domain ) . '</a> '; | |
$rendered .= __( '(see Appearance > ' . $this->strings['menu_title'] . ' for future reference)', $this->domain ); | |
$rendered .= '</p>'; | |
// Swap to... |
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_get_posts', 'ja_search_filter' ); | |
/** | |
* Exclude category 7 from search results. | |
* | |
* @since ?.?.? | |
* @author Jared Atchison | |
* @link https://gist.github.com/1300302 | |
* |
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( 'genesis_post_comments_shortcode', 'justins_uber_cool_function' ); | |
/** | |
* Amend the location of the comments link, from #comments to #respond. | |
* | |
* @since ?.?.? | |
* @author Gary Jones | |
* | |
* @param string $output HTML markup - link in a span | |
* @return string Amended HTML markup |
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 | |
/** | |
* Allows XHTML sitemap to be added | |
* | |
* @package GT_Sitemap | |
* @author Gary Jones | |
* @version 2010-05-19 | |
* @since 2010-03-20 | |
*/ |
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( 'mce_buttons_2', 'wps_mce_buttons_2' ); | |
/** | |
* Show the style dropdown on the second row of the editor toolbar. | |
* | |
* This code also adds the font family and font size dropdowns too, along with a horizontal rule button. | |
* | |
* @param array $buttons Exising buttons | |
* @return array Amended buttons |
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
#!/usr/bin/perl -pi | |
s/[\t]+$//g; | |
s/^\s+$/\n/g; |
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
jQuery(function ($) { | |
// Remove default Genesis behaviour for this select element. | |
// If Genesis switches to using on() instead of live(), replace with a similar call | |
// to off() instead of die(). The genesis event namespace only added in Genesis 1.8.0 | |
$('#genesis-settings\\[content_archive\\]').die('change.genesis'); | |
// Add in our behaviour, using multiple namespaces to try and play nicely with others | |
$('#genesis-theme-settings-posts').on('change.genesis.my_theme_or_plugin', '#genesis-settings\\[content_archive\\]', my_theme_or_plugin.toggle_settings); |
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 determine if a meta boxes exists for a given context on | |
* a given page. | |
* | |
* @global array $wp_meta_boxes | |
* | |
* @param string $page Name of the admin page | |
* @param string $context Name of the meta box context |
OlderNewer