Skip to content

Instantly share code, notes, and snippets.

View trajche's full-sized avatar
🍕
Hungry

Trajche TJ Kralev trajche

🍕
Hungry
  • Helsinki, Finland
View GitHub Profile
@trajche
trajche / functions.php
Last active December 31, 2015 08:59
Remove WP Core Update Notifications
add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );
@trajche
trajche / functions.php
Created March 2, 2014 12:32
Remove Woothemes Update Notification Nags
remove_action( 'admin_notices', 'woothemes_updater_notice' );
@trajche
trajche / functions.php
Last active December 22, 2023 10:54
Remove Yoast SEO version from header
add_action('get_header', 'start_ob');
add_action('wp_head', 'end_ob', 999);
function start_ob() {
ob_start('remove_yoast');
}
function end_ob() {
ob_end_flush();
}
@trajche
trajche / functions.php
Created March 2, 2014 12:32
Woocommerce: Add product out of stock badge
add_action('woocommerce_before_shop_loop_item_title','product_out_of_stock_badge');
function product_out_of_stock_badge() {
global $woocommerce, $product, $post;
$post_id = $post->ID;
$available_variations = $product->get_available_variations();
foreach ($available_variations as $variation) {
$isinstock = $variation[is_in_stock];
if ($isinstock === true) {
$i++;
}
@trajche
trajche / sitename.conf
Last active August 29, 2015 13:57 — forked from marijnvdwerf/gist:2399778
Kirby Nginx Rewrite SEO URL's
location / {
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php last;
break;
}
}
location /panel {
if (!-e $request_filename) {
rewrite ^/(.*)$ /panel/index.php last;
@trajche
trajche / unzip.php
Last active September 28, 2022 18:17
Unzip a file on one.com with PHP
<?php
$unzip = new ZipArchive;
$out = $unzip->open('file-name.zip');
if ($out === TRUE) {
$unzip->extractTo(getcwd());
$unzip->close();
echo 'File unzipped';
} else {
echo 'Something went wrong?';
@trajche
trajche / functions.php
Created October 23, 2014 19:30
Remove Default Wordpress Thumbnail Sizes
//Remove default thumbanail sizes on all blogs (works on Wordpress multisite also)
<?php
function remove_default_image_sizes( $sizes) {
unset($sizes['thumbnail']);
unset($sizes['medium']);
unset($sizes['large']);
return $sizes;
}
add_filter('intermediate_image_sizes_advanced','remove_default_image_sizes');
@trajche
trajche / multi-skype
Created December 8, 2014 17:52
two skypes on mac
defaults write com.two.skype DataPath ~/Library/Application\ Support/Skype\ Two
Installing new box for nginx-wordpress (ubuntu minimal):
Prepare server
------------------------------------
apt-get update
apt-get upgrade
apt-get dist-upgrade #upgrade distribution
apt-get install sudo dialog software-properties-common python-software-properties
apt-get install bsdutils #for percona
@trajche
trajche / nginx.conf
Last active August 29, 2015 14:26 — forked from phpdude/nginx.conf
Nginx image filter + caching of results.
location /resize {
alias /tmp/nginx/resize;
set $width 150;
set $height 100;
set $dimens "";
if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) {
set $width $1;
set $height $2;
set $image_path $3;