This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array | |
( | |
[selected_value] => Dropdown 2 | |
[selected_option] => Array | |
( | |
[value] => Dropdown 2 | |
[key] => dropdown_num_3 | |
[is_selected] => 1 | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array | |
( | |
[selected_value] => Radiobutton 2 | |
[selected_radiobutton] => Array | |
( | |
[value] => Radiobutton 2 | |
[key] => radiobutton_num_3 | |
[is_selected] => 1 | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array | |
( | |
[id] => 14 | |
[is_image] => 1 | |
[url] => http://example.com/wordpress/wp-content/uploads/2012/10/product-cat-2.jpeg | |
[mime] => image/jpeg | |
[link] => Array | |
( | |
[full] => <a href='http://example.com/wordpress/wp-content/uploads/2012/10/product-cat-2.jpeg' title='product-cat-2'><img width="1024" height="768" src="http://example.com/wordpress/wp-content/uploads/2012/10/product-cat-2.jpeg" class="attachment-full" alt="product-cat-2" title="product-cat-2" /></a> | |
[thumbnail] => <a href='http://example.com/wordpress/wp-content/uploads/2012/10/product-cat-2.jpeg' title='product-cat-2'><img width="150" height="112" src="http://example.com/wordpress/wp-content/uploads/2012/10/product-cat-2.jpeg" class="attachment-thumbnail" alt="product-cat-2" title="product-cat-2" /></a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* If a page has the more-tag added then wrap the content before the more-tag in a div with the class | |
* .entry-content-teaser | |
* this makes it easy for us to style the teaser, like making in bold. | |
* we hook onto prio 9 instead of 10 so it run before the content has got the tags added | |
*/ | |
add_filter("the_content", "teasify_the_content", 9); | |
function teasify_the_content($content) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Minimal amount of code | |
// to create a new field group | |
// with one field | |
simple_fields_register_field_group('attachment', array( | |
'name' => 'Attachment', | |
'fields' => array( | |
array( | |
'name' => 'File', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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"; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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) |