Howdy, I'm making a custom section and it needs a type-ahead box that searches for other custom post types to feature in it. The big question is how I save a custom option 'type' values (i.e., not one of the built-in "text", "checkbox", etc).
Saving values from custom option "types"
Best Answer bigdawggi , 11 January 2013 - 09:18 PM
So after a long break I was able to get back to this and realized that the field just needed the proper name -- which comes from the $o (option element defined in the `section_optionator()` function.
Example defining option:
$options = array(
'galleries' => array(
'title' => 'Gallery',
'type' => 'gallery_type_ahead',
'inputlabel' => 'Gallery',
'exp' => 'Start typing the name of the gallery you want to display.',
'shortexp' => 'Pick your gallery you want to display.'
),
);
And now to output in the section admin
foreach ($o['val'] as $key => $gallery_id) {
?>
<li>
<input type="text" id="<?php echo esc_attr($o['input_id'].'-'.$key); ?>" name="<?php echo esc_attr($o['input_name']); ?>[]" class="gallery-typeahead" value="<?php echo intval($gallery_id); ?>" />
</li>
<?php
}
I believe I had been trying the $oid variable instead of the $o (which I know understand, stands for option). Baby steps ![]()
Now my question is how to validate the entered values, but I'll look around for that.
Thanks for everyones help!
Go to the full post
#1
Posted 02 January 2013 - 06:32 PM
#2
Posted 03 January 2013 - 05:20 AM
Hi there,
I'll speak to a member of the developer team to see if they can point you in the right direction and come back to you once I hear from them.
If you're looking into making a custom sections, you should look into signing up to our Junto/developer group
#3
Posted 03 January 2013 - 02:23 PM
Thanks James, I've done that as well and am waiting for their approval of my application. If there's a way to hasten that process I'm game for that route too ![]()
I look fwd to their reply! Thanks!
#4
Posted 04 January 2013 - 10:24 PM
Why not use a dropdown of all available types?
#5
Posted 04 January 2013 - 11:49 PM
Thanks Simon_P, but it's not to make available the listing of custom post types; The end result is to provide the user the ability to select multiple individual post type items.
Example:
There's a post type of videos
This section would allow the editors to type inside it for the name of a singular video; then click "+" to add another input to search for another video to populate this section with, and so on.
I haven't seen a section that allows for that type of functionality.
The issue I was having (and haven't been able to go back and test more yet) is the saving of the values of those text inputs that will contain the titles/ids of those videos.
#6
Posted 11 January 2013 - 09:18 PM Best Answer
So after a long break I was able to get back to this and realized that the field just needed the proper name -- which comes from the $o (option element defined in the `section_optionator()` function.
Example defining option:
And now to output in the section admin
I believe I had been trying the $oid variable instead of the $o (which I know understand, stands for option). Baby steps ![]()
Now my question is how to validate the entered values, but I'll look around for that.
Thanks for everyones help!
Also tagged with one or more of these keywords: options, sections, custom options, option type
PageLines Framework →
Technical Support →
Twitter ErrorsStarted by Rob , 14 Jun 2013 |
|
|
||
PageLines Framework →
Technical Support →
How To Make PageLines Base Section Display Custom FieldsStarted by justinn , 05 Jun 2013 |
|
|
||
No sections found in Drag & DropStarted by levelup , 23 May 2013 |
|
|
||
PageLines Framework →
Technical Support →
LESS/CSS error has nearly crashed siteStarted by eglashcreative , 15 May 2013 |
|
|
||
PageLines Framework →
Customizations →
How can I create a new custom section?Started by andreia24 , 26 Apr 2013 |
|
|











