Skip to content

Instantly share code, notes, and snippets.

View attitude's full-sized avatar

Martin Adamko attitude

View GitHub Profile
@attitude
attitude / function-array_merge_for_sql.php
Last active December 19, 2015 10:58
Function to merge new SQL argument arrays (right) with defaults (left)
<?php
/**
* Merges new SQL argument arrays with defaults
*
* Differs from {@link array_merge()} and {@link array_merge_recursive()}:
*
* 1. Array of 'where', 'orderby', 'groupby' and 'join' keys should be
* appended and remain unique.
* 2. 'select', 'limit' should be overwritten, by new argument on right
@attitude
attitude / wp-register-the-post-thumbnail.php
Last active December 19, 2015 06:09
Register the Post Thumbnail Support Snippet/Plugin for WordPress with one click
<?php
/*
Plugin Name: Snipet: Enable `the_post_thumbnail`
Plugin URI: http://www.attitude.sk
Description: Displays `Post thumbnail` in post
Version: 0.1.0
Author: Mrg. art. Martin Adamko
Author URI: http://www.attitude.sk
License: The MIT License (MIT)
@attitude
attitude / wp-contact-methods.php
Last active December 19, 2015 05:09
Add/Remove User Contact Methods WordPress Snipet/Plugin
<?php
/*
Plugin Name: Snipet: Add/Remove User Contact Methods
Plugin URI: http://www.attitude.sk
Description: Adds phone field to the user edit screen
Version: 0.1.1
Author: Martin Adamko
Author URI: http://www.attitude.sk
License: The MIT License (MIT)
@attitude
attitude / composer.json
Last active December 19, 2015 02:48
Handy function to return file name without extension
{
"name": "attitude/Functions/get_file_filename"
}
@attitude
attitude / composer.json
Last active December 19, 2015 02:48
Handy function to return file extension
{
"name": "attitude/Functions/get_file_extension"
}
@attitude
attitude / patch-1049.diff
Created March 13, 2013 21:02
Patch for possible fix for issue #1049 of Pods Framework.
diff --git a/classes/PodsAPI.php b/classes/PodsAPI.php
index 129badf..571bd1a 100644
--- a/classes/PodsAPI.php
+++ b/classes/PodsAPI.php
@@ -3020,9 +3020,7 @@ class PodsAPI {
if ( !empty( $related_ids ) ) {
update_metadata( $object_type, $id, '_pods_' . $related_field[ 'name' ], $related_ids );
- foreach ( $related_ids as $rel_id ) {
- add_metadata( $object_type, $id, $related_field[ 'name' ], $rel_id );
@attitude
attitude / do_action_timestamp.php
Created February 29, 2012 09:49
Display Timestamps when Debugging WordPress for Speed
<?php
//----------------------------------------------------------------------------------------------
// Display Timestamps when Debugging WordPress for Speed
//----------------------------------------------------------------------------------------------
//
// A GIST by Martin Adamko, martin(at)attitude.sk
//
// It happens from time to time you need to know where the crack is. I assume you are willing
// to kick in the WP source and put some 'echos' in there. But WP has 2 functions to help you