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 / test.css
Last active August 29, 2015 14:02
css test
body {
background: red;
}
body:after {
content: "css changed";
position: absolute;
top: 20px;
left: 20px;
@bonny
bonny / test.js
Created June 2, 2014 07:35
script test
alert(123);
document.write(456);
name: inverse
layout: true
class: middle, inverse
---
## Detta är en presentation
Diggar man markdown är detta ett väldigt enkelt sätt att skapa presentationer på serru.
- Använder markdown
@bonny
bonny / dabblet.css
Created December 17, 2011 21:58
This is my dabblet!
/**
* This is my dabblet!
*/
background: red;
#background: linear-gradient(45deg, #f06, yellow);
min-height:100%;
/**
* get all values or just the from a field in a field group
* @param $post_id
* @param $field_name_or_id name as string or field group id and field id as array.
* for example array(3,2) to fetch field 2 from field group 3
* @param $single bool return a single (the first) value or all values (as array)
* @return string or array
*/
simple_fields_get_post_value($post_id, $field_name_or_id, $single = true)
@bonny
bonny / gist:3830056
Created October 3, 2012 21:42
example: simple_fields_get_post_value
<?
/**
* get all values or just the from a field in a field group
* @param $post_id
* @param $field_name_or_id name as string or field group id and field id as array.
* for example array(3,2) to fetch field 2 from field group 3
* @param $single bool return a single (the first) value or all values (as array)
* @return string or array
*/
@bonny
bonny / gist:3847600
Created October 7, 2012 09:07
Simple Fields minimal field extension example
<?php
add_action("plugins_loaded", "init_simple_fields_field_minimalexample");
function init_simple_fields_field_minimalexample() {
class simple_fields_field_minimalexample extends simple_fields_field {
public $key = "minimalexample", $name = "Minimalistic example field";
@bonny
bonny / gist:3847654
Created October 7, 2012 09:30
Simple Fields Extension API Example
<?php
/**
* This is an example field type extension for Simple Fields
* Use this as base or inspiration for your own fields
*/
// Make sure simple fields have loaded before we try to do anything. Will get errors otherwise.
add_action("plugins_loaded", "init_simple_fields_field_example");
@bonny
bonny / simple_fields_set_value_example.php
Last active October 11, 2015 11:27
Simple Fields function simple_fields_set_value()
<?php
/**
* Update/Set a value for a field for a post
* Warning: Highly untested!
*
* @param int $post_id
* @param string $field_slug field key
* @param int $numInSet if field is repeatable this tells what position it should be stored at. Default is null = add new
* @param mixed $post_connector string __none__, __inherit__, or int id of post connector to use for this post, if no connector is defined already
@bonny
bonny / gist:3851566
Created October 8, 2012 09:16
Simple Fields getting values
/**
* Gets a single value.
* The first value if field group is repeatable
*
* @param string $field_slug
* @param int $post_id ID of post or null to use current post in loop
* @param array $options Array or query string of options to send to field type
* @return mixed string or array, depending on the field type
*/
function simple_fields_value($field_slug = NULL, $post_id = NULL, $options = NULL) {