Jump to content

Saving values from custom option "types"

Recommended Posts


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).

I've looked through the "pagelines-section-template" code, and watched the YouTube tutorials, but those all give examples of a "text" option type, not a custom one.  
I found the action inside `class.options.engine.php` for outputting the custom option type (below), so that's not a problem:
do_action( 'pagelines_options_' . $o['type'] , $oid, $o);
...but I'm falling short on finding where to save the option's values.
Thanks in advance!

Share this post

Link to post
Share on other sites
James B

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 http://developer.pagelines.com/apply/

Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post

Link to post
Share on other sites

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!

Share this post

Link to post
Share on other sites

Why not use a dropdown of all available types?

Share this post

Link to post
Share on other sites

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.  



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.

Share this post

Link to post
Share on other sites

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) {
    <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); ?>" />

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!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • yemoonyah
      By yemoonyah+
      Hi, even though I just got a SSL certificate, I can't get the green padlock to appear due to the following error:
      :A file with an insecure url of "http://yemoonyah.com/wp-content/plugins/pl-section-boxes/check.svg" was loaded via the javascript file: https://yemoonyah.com/wp-includes/js/jquery/jquery.js?ver=1.12.4 on line 3. The insecure URL may not be directly contained in the script file and may exist elsewhere."
      I figured if I delete and re-install the plugin it might fix the problem but will my boxes on the website still be there? Or do I have to redesign everything all over again if I delete the plugin and then re-install it?
    • cstudio
      By cstudio
      I need some help!  I am trying to add a Square booking script.  When I add it to a embed section it crashes the page editor and I am unable to save the page version.  I have tried using different browsers with the same result.
       I can add the script on the backend in the word press content area and get it to show and work, but it look terrible.  A page with in a page.  http://www.zoeanastacia.com/booking/.
      I need help getting the page editor to work properly or to make the wp content section to not look like an 90's iframe.
    • oseehys
      By oseehys+
      Hello There,
      So i want to use platform 5 and DMS sections on a single page, i am using a child theme with pinspro as my main theme and i activated platform 5, the only problem am having so far is the fixed option, my navbars are not aligning to their default size, and it will be great if platform 5 header and footer section will function, has anyone used this option, how can i make the best use of platform 5 and DMS on a site
    • yemoonyah
      By yemoonyah+
      I tried to make a simple change on my opt-in page today by reordering two sections.
      Now they won't save and whatever I do, the same 2 section will be stuck to the top.
      This is a huge problem since it is my opt-in page!
      (I'm on the latest WP & PL version)
    • Anthony King
      By Anthony King+
      I have to say that I like the Layout and the Template based sections. Some of them are really impressive.
      One of the things that I would like to request though is the possibility of being able to dynamically rearrange the layout.
      An example of what I am talking about is take the Agency Section. It's current layout starts with the
      Splash Module then the Portfolio Module then the Service Module and so on and so forth.
      What would be great is if we were able to move these modules around. I.e have the Service Module first
      then maybe the Splash, and then the portfolio.