Forum Replies Created
-
AuthorPosts
-
SteveKeymaster@mcmaster– I can’t reproduce. Can you provide step by step instructions or a screencast?
SteveKeymasterPiklist uses a 12 column grid. So each row of fields should equal 12. Try this:
piklist( 'field', array( 'type' => 'group', 'field' => 'home_news', 'label' => 'Featured News', 'description' => 'Information for the home page news feature.', 'template' => 'field', 'fields' => array( array( 'type' => 'text', 'field' => 'section_title', 'columns' => 8, // First row: 8 columns 'label' => 'News Section Title', 'value' => "What's New", ), array( 'type' => 'number', 'field' => 'section_quantity', 'label' => 'Number of Posts', 'description' => 'How many recent posts should we display?', 'columns' => 4, // First row: 4 columns. Row will end here because 12 columns have been reached. 'value' => 2, 'validate' => array( array( 'type' => 'range', 'options' => array( 'min' => 1, 'max' => 4, ), ), ), ), array( 'type' => 'text', 'field' => 'section_link_text', 'label' => 'Text for Link to News Page', 'value' => 'View All News', 'columns' => 12, // Second row starts here 'validate' => array( array( 'type' => 'safe_text', ), ), ), ), ));
SteveKeymaster@jimmyjazz– Piklist currently groups all widgets in the same plugin or theme. No way around this yet. Agreed, it doesn’t make much sense for a single widget. On our list of things to look at after 1.0
SteveKeymasterThanks, Donna. We’ll look into it.
SteveKeymasterWe’re looking into this.
SteveKeymaster@devonanderson– We’ve been trying to reproduce but can’t. Can you verify that you have the table
wp_termmetain your db? This came up with another user.
SteveKeymasterThis week. Working on a few more things
SteveKeymaster@rcantor– The json api has a filter, json_api_encode, that you can use to manipulate the data before the output.
Try this:
add_filter('json_api_encode', 'my_json_api_encode'); function my_json_api_encode($data) { // Are we on a single post if (is_single()) { // Get the sources_group field $sources_group = get_metadata('post', $data['post']->id, 'sources_group', true); if ($sources_group) { foreach ($sources_group as $index => &$group) { // Add the index to the objecdt $group['order'] = $index; } // Add updated object back to the json $data['post']->sources_group = $sources_group; } } return $data; }It should render like this:
"sources_group":[ { "source_title":"title 1" ,"source_text":"text 1" ,"source_url":"http:\/\/piklist.com" ,"order":0 } , { "source_title":"title 2" ,"source_text":"text 2" ,"source_url":"http:\/\/google.com" ,"order":1 } ]Let me know if that works for you.
SteveKeymasterMy pleasure… closing ticket.
SteveKeymaster@kplaneta– Piklist uses the WordPress settings api, which will reject anything that’s not a field. Then Piklist will render that markup on top. You can use the Piklist HTML field to render out what you want.
piklist('field', array( 'type' => 'html' ,'label' => '<h3>My title</h3> ));October 27, 2015 at 10:19 am in reply to: Creating conditional field for something not equal to 'none' #4760
SteveKeymaster@rcantor– I’m not sure I’m 100% clear on your request, so I hope this makes sense.
After the user selects
featured_post_id, they would need to save the page. Then you can use get_posts() to pull in the data you need.
SteveKeymasterThanks. This will be updated in 0.9.9.5.
SteveKeymasterAlways happy to make our site more readable. 😉
Closing this ticket.
SteveKeymasterWordPress stores this data in a serialized array. You can unserialize two ways:
1) Use the standard WordPress functionget_post_meta:
$sources_group = get_post_meta($post->ID, 'sources_group', true);2) Unserialize with the standard PHP function,
unserialize.Does that make sense?
-
AuthorPosts