Unyson icon indicating copy to clipboard operation
Unyson copied to clipboard

Getting saved metabox values.

Open webangon opened this issue 12 years ago • 9 comments

Thank you for this awesome framework.However I am unable to get the meta values.How can I get the meta value of this?

    'demo_addable_option_2' => array(
        'label' => __('Addable Option', 'fw'),
        'type'  => 'addable-option',
        'option' => array(
            'type' => 'text',
        ),
        'value' => array('Option 1', 'Option 2', 'Option 3'),
        'desc'  => __('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
        'help'  => sprintf("%s \n\n'\"<br/><br/>\n\n <b>%s</b>",
            __('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'fw'),
            __('Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium', 'fw')
        )
    ),

webangon avatar Oct 25 '14 03:10 webangon

  • fw_get_db_settings_option('demo_addable_option_2') if the option is used in framework-customizations/theme/options/settings.php
  • fw_get_db_post_option($post_id, 'demo_addable_option_2') if the option is used in framework-customizations/theme/options/posts/{post-type}.php
  • fw_get_db_term_option($term_id, $taxonomy, 'demo_addable_option_2') if the option is used in framework-customizations/theme/options/taxonomies/{taxonomy}.php

ghost avatar Oct 25 '14 05:10 ghost

Thank you.I tried to show the value but this returned nothing.Can you please point my mistake?

webangon avatar Oct 26 '14 18:10 webangon

Sorry, I made a mistake. The fw_get_db_post_option() first parameter is the post id then the option id. (I updated the comment above)

You can find those functions in docs

ghost avatar Oct 26 '14 18:10 ghost

sorry fixed it.Thanks again for this framework

webangon avatar Oct 26 '14 18:10 webangon

echo implode(', ', fw_get_db_post_option($postid, 'demo_addable_popup_2', array()));

ghost avatar Oct 26 '14 19:10 ghost

Is fw_get_db_post_option() used for blog posts or can I use it to return all options in page-builder?

When I print fw_get_db_post_option(0) it returns all options for the page_id and shows 'btn_color' inside the json array.

If I print fw_get_db_post_option(0, 'btn_color') it returns null.

If not how can I get the page-builder options like $atts in shortcode view?

NwpDeveloper avatar Mar 25 '16 17:03 NwpDeveloper

return all options in page-builder

It's not possible. page-builder options are available only in shortcode view.php

ghost avatar Mar 25 '16 17:03 ghost

Ok Thanks. Then is fw_get_post_option() only for blog posts because it returns the current pages options if printing from the view?

NwpDeveloper avatar Mar 25 '16 18:03 NwpDeveloper

Yes, fw_get_post_option() is only for post options (any post type, not only blog posts)

ghost avatar Mar 25 '16 19:03 ghost