Skip to content

Instantly share code, notes, and snippets.

View attitude's full-sized avatar

Martin Adamko attitude

View GitHub Profile
@attitude
attitude / wp-json-api-post-meta.diff
Created February 12, 2014 20:13
Patch `lib/class-wp-json-posts.php` to support saving, updating and deleting post meta using WP REST API. #proposal #JSON #REST #WordPress
diff --git a/lib/class-wp-json-posts.php b/lib/class-wp-json-posts.php
index e440b25..59c6bfd 100644
--- a/lib/class-wp-json-posts.php
+++ b/lib/class-wp-json-posts.php
@@ -847,14 +847,57 @@ class WP_JSON_Posts {
return $can_insert;
}
- // Post meta
- // TODO: implement this
@attitude
attitude / composer.json
Last active August 29, 2015 13:57
Function to check if array is associative (key-value)
{
"name": "attitude/Functions/is_assoc_array",
"autoload": {
"files": ["function-is_assoc_array.php"]
}
}
@attitude
attitude / content.yaml
Created May 1, 2014 01:31
First site contnt data for example usage of Macaw together with Publisher
---
################################################################################
#
# COLLECTIONS
#
################################################################################
_id: homepage
_type: collection
route: /
template: homepage
@attitude
attitude / officeOfHelena.js
Created November 18, 2014 11:08
Description for my my friend's IT colleagues to explain them how to leave door open/closed properly.
/*! Closing the Door by Martin Adamko (c) 2014, MIT Licence */
var officeOfHelena = {
person: {
name: "Helena",
surname: "Székhelyi"
}
};
(function(office) {
@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
@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 / composer.json
Last active December 19, 2015 02:48
Handy function to return file extension
{
"name": "attitude/Functions/get_file_extension"
}
@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 / 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 / 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)