Skip to content

Instantly share code, notes, and snippets.

View bonny's full-sized avatar
🇺🇦
StandWithUkraine

Pär Thernström bonny

🇺🇦
StandWithUkraine
View GitHub Profile
@bonny
bonny / gist:3923117
Created October 20, 2012 12:00
Radiobutton field, Extended Return Values
Array
(
[selected_value] => Radiobutton 2
[selected_radiobutton] => Array
(
[value] => Radiobutton 2
[key] => radiobutton_num_3
[is_selected] => 1
)
@bonny
bonny / gist:3923633
Created October 20, 2012 15:40
Dropdown Field, Extended Return Values
Array
(
[selected_value] => Dropdown 2
[selected_option] => Array
(
[value] => Dropdown 2
[key] => dropdown_num_3
[is_selected] => 1
)
@bonny
bonny / gist:3923693
Created October 20, 2012 15:52
Extended Return Values for Post field
Array
(
[id] => 41
[title] => Post to test extended return values
[permalink] => http://example.com/wordpress/?p=41
[post] => stdClass Object
(
[ID] => 41
[post_author] => 1
[post_date] => 2012-10-19 13:58:19
@bonny
bonny / gist:3923744
Created October 20, 2012 16:00
Taxonomy field Extended Return Values
Array
(
[name] => category
[singular_name] => Category
[plural_name] => Categories
[taxonomy] => stdClass Object
(
[hierarchical] => 1
[update_count_callback] =>
[rewrite] => Array
@bonny
bonny / gist:3923774
Created October 20, 2012 16:08
Taxonomy Term Extended Return Values
Array
(
[terms] => Array
(
[0] => Array
(
[name] => Uncategorized
[slug] => uncategorized
[id] => 1
[term] => stdClass Object
@bonny
bonny / gist:3923838
Created October 20, 2012 16:26
Date Extended Return Values
Array
(
[saved_value] => 27/10/2012
[timestamp] => 1351296000
[date_format] => October 27, 2012
)
@bonny
bonny / gist:3923967
Created October 20, 2012 16:48
User Field Extended Return Values
Array
(
[id] => 1
[first_name] => phil
[last_name] => roberts
[user_login] => phil
[user_email] => user@example.com
[user_nicename] => philly
[display_name] => philly
[user] => WP_User Object
@bonny
bonny / gist:4009011
Created November 3, 2012 22:00
Simple Fields Date & Time Picker return values
Array
(
[date_only] => Array
(
[type] => date
[date_unixtime] => 1351900800
[ISO_8601] => 2012-11-03
[RFC_2822] => Sat, 03 Nov 2012 00:00:00 +0000
[Y-m-d] => 2012-11-03
[date_format] => November 3, 2012
@bonny
bonny / gist:5005579
Last active December 14, 2015 01:19
with_posts() WordPress function example usage
<?php
/**
* Examples for WordPress function with_posts()
*
* The main function is available here:
* https://gist.github.com/bonny/5011943
*
* Author and contact info:
* https//twitter.com/eskapism
@bonny
bonny / with-posts-wordpress-function.php
Last active May 9, 2016 18:50
WordPress function with_posts(), that simplifies getting and looping posts, in a jQuery anonymous function-ish way. Setups global, restores post afterwards. Simple, flexible and powerful.
<?php
/**
* WordPress WP_QUERY-wrapper to simplify getting and working with posts
*
* Does something with posts, using a callback
* Setups global post variable before running callback
* And restores it afterwards
*
* An introductionary blogpost about this function is posted on our blog: