function my_box_post_layout($post) { $layouts = array('right' => get_template_directory_uri() . '/media/admin/images/left.layout.png', 'left' => get_template_directory_uri() . '/media/admin/images/right.layout.png', 'full' => get_template_directory_uri() . '/media/admin/images/full.layout.png'); $sidebars = myThemes::get('sidebars-list'); if (!is_array($sidebars)) { $sidebars = array(); } $values = array('main-sidebar' => __('Main Sidebar', 'myThemes'), 'front-page-sidebar' => __('Front Page Sidebar', 'myThemes'), 'page-sidebar' => __('Page Sidebar', 'myThemes'), 'single-sidebar' => __('Single Sidebar', 'myThemes'), 'additional-sidebar' => __('Additional Sidebar', 'myThemes')); /* LAYOUT */ echo ahtml::template(array('type' => array('template' => 'inline', 'input' => 'logic'), 'label' => __('Use custom layout', 'myThemes'), 'fieldName' => 'use-post-layout', 'action' => "{'t' : '.mythemes-post-layout' , 'f' : '-' }", 'value' => meta::get($post->ID, 'use-post-layout'))); $use_post_layout = meta::get($post->ID, 'use-post-layout'); if (strlen($use_post_layout) == 0 || $use_post_layout === "0") { $classes = 'mythemes-post-layout hidden'; } else { $classes = 'mythemes-post-layout'; } if ($post->post_type == 'post') { $type = 'single'; } else { $type = $post->post_type; } $rett = ahtml::template(array('type' => array('template' => 'inline', 'input' => 'imageSelect'), 'values' => $layouts, 'coll' => 2, 'label' => __('Select Layout', 'myThemes'), 'fieldName' => 'post-layout', 'value' => meta::dget($post->ID, 'post-layout', myThemes::get($type . '-layout')), 'action' => "[ 'hs' , { 'full' : '.mythemes-layout-sidebar' } ]")); if (meta::get($post->ID, 'post-layout') == 'full') { $sidebarClass = 'mythemes-layout-sidebar hidden'; } else { $sidebarClass = 'mythemes-layout-sidebar'; } $rett .= ahtml::template(array('type' => array('template' => 'inline', 'input' => 'select'), 'values' => $values, 'label' => __('Select sidebar', 'myThemes'), 'fieldName' => 'post-sidebar', 'templateClass' => $sidebarClass, 'value' => meta::dget($post->ID, 'post-sidebar', myThemes::get($type . '-sidebar')))); echo ahtml::template(array('type' => array('template' => 'code'), 'content' => $rett, 'templateClass' => $classes)); }