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
| /** | |
| * Excludes our theme from the WordPress update API calls. | |
| * | |
| * @param array $request The arguments used in an HTTP request | |
| * @param string $url The request URL. | |
| * @return array $request The arguments used in an HTTP request. | |
| */ | |
| public function excludeFromThemeUpdates($request, $url) | |
| { | |
| if(0 !== strpos($url, 'https://api.wordpress.org/themes/update-check')) |
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 | |
| namespace ChangeMe\Theme\Modules; | |
| class Core { | |
| public function __construct() { | |
| add_action('admin_init', array($this, 'disable_category_feature')); | |
| add_filter('rewrite_rules_array', array($this, 'remove_category_rewrites')); | |
| } |
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( 'init', 'create_model_taxonomy' ); | |
| function create_model_taxonomy() { | |
| register_taxonomy( | |
| 'model', | |
| 'resource', // Might need to change this if the CPT has a different name. | |
| array( | |
| 'label' => __( 'Tanel\'s Model' ), | |
| 'rewrite' => array( 'slug' => 'model' ), |
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
| var emails = []; | |
| // Magento 1.7 -- Customer Management Screen | |
| // Make sure to list out all/most of your customers -- or this loses its effectiveness as pagination is now in play. | |
| jQuery('.data tr td:nth-child(4)').each(function() { // Email is in the forth column. | |
| var email = $(this).text().trim(); | |
| if(jQuery.inArray(email, emails) === -1) { | |
| emails.push(email); | |
| } else { | |
| $(this).css('background-color', 'red'); // Visually find the duplicate. |
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
| var emails = []; | |
| // Intended to be ran from the Customer Management screen of Magento 1.7 | |
| // This really only works if you have < 3000 accounts. | |
| // Why? Because 1.7 only shows up to 3000 at a time. If pagination comes into play, this thing becomes less effective. | |
| // But you could probably still hack it to get some data out and still do what you were looking to do. | |
| jQuery('.data tr td:nth-child(4)').each(function() { // Email is in the forth column of the table. | |
| var email = $(this).text().trim(); | |
| if(jQuery.inArray(email, emails) === -1) { | |
| emails.push(email); |
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
| #!/bin/sh | |
| disallowed="@debug" | |
| RED='\033[0;31m' | |
| YELLOW='\033[1;33m' | |
| NC='\033[0m' # No Color | |
| git diff --cached --name-status | while read x file; do | |
| if [ "$x" == 'D' ]; then continue; fi |
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
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
| <!--[if IE 6]> | |
| <html id="ie6" lang="en-US"> | |
| <![endif]--> | |
| <!--[if IE 7]> | |
| <html id="ie7" lang="en-US"> | |
| <![endif]--> | |
| <!--[if IE 8]> | |
| <html id="ie8" lang="en-US"> |
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( 'wp_generate_attachment_metadata', __NAMESPACE__ . '\\update_attachment_metadata', 10, 2 ); | |
| function update_attachment_metadata( $data, $attachment_id ) { | |
| $dimensions = false; | |
| $post = get_post( $attachment_id ); | |
| $file = wp_get_attachment_url( $attachment_id ); | |
| $path = get_attached_file( $attachment_id ); |
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
| var timestmp = new Date().setFullYear(new Date().getFullYear(), 0, 1); | |
| var yearFirstDay = Math.floor(timestmp / 86400000); | |
| var today = Math.ceil((new Date().getTime()) / 86400000); | |
| var dayOfYear = today - yearFirstDay; | |
| var currentHourOfYear = dayOfYear * 24 - 24 |
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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> | |
| <url> | |
| <loc>http://www.example.com/foo.html</loc> | |
| </url> | |
| </urlset> |