Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- @autor: José Neto <josenetome@gmail.com>
- @description: Get options from inactive layouts <OptionTree:Wordpress>
- @usage: ot_get_option_by_layout($field, $layout, $default)
- */
- if ( ! function_exists( 'ot_get_option_by_layout' ) ) {
- function ot_get_option_by_layout( $option_id, $layout, $default = '' ) {
- /* get the saved options */
- $layouts = get_option( 'option_tree_layouts' );
- /* get options by layout */
- foreach ( $layouts as $layout_name => $fields ) {
- if ( $layout_name == 'active_layout') continue;
- /* check if layout exists */
- if ( $layout_name == $layout ) {
- /* get fields of this layout */
- $fields = unserialize ( base64_decode ( $fields ) );
- /* fields loop */
- foreach ( $fields as $option_name => $value) {
- /* look for the saved value */
- if ( $option_name == $option_id && $value != NULL ) {
- return $value;
- }
- } /* end fields loop */
- }
- }
- return $default;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement